﻿// DialogIO.cpp : 实现文件
//

#include "stdafx.h"
#include "DefectInspectionSystem.h"
#include "CDialogIO_OnLine.h"
#include "afxdialogex.h"
#include<math.h>
#include "DefectInspectionSystemDlg.h"


//BYTE theApp.temp[69][8] = { 0 };
//BYTE theApp.text[69] = { 0 };

// CCDialogIO_OnLine 对话框

IMPLEMENT_DYNAMIC(CCDialogIO_OnLine, CDialogEx)

int CCDialogIO_OnLine::power(int a, int b)
{
	int val = 1;
	for (int i = 0; i < b; i++)
	{
		val *= a;
	}
	return val;
}

//int get_length(int a)
//{
//	int length = 0;
//	while (a)
//	{
//		a /= 10;
//		length++;
//	}
//	return length;
//}
//
//int get_value(int a, int i)
//{
//	int value;
//	value = a % power(10, i) / power(10, i - 1);
//	return value;
//}
//
//int bi2dec(int a)
//{
//	int val = 0;
//	for (int i = 1; i <= get_length(a); i++)
//	{
//		val += get_value(a, i) * power(2, i - 1);
//	}
//	return val;
//}

//int转byte

void  CCDialogIO_OnLine::intToByte(int i, byte* bytes, int size )
{
	//byte[] bytes = new byte[4];
	memset(bytes, 0, sizeof(byte) * size);
	bytes[0] = (byte)(0xff & i);
	bytes[1] = (byte)((0xff00 & i) >> 8);
	bytes[2] = (byte)((0xff0000 & i) >> 16);
	bytes[3] = (byte)((0xff000000 & i) >> 24);
	return;
}
//
////byte转int
//int bytesToInt(byte* bytes, int size = 4)
//{
//	int addr = bytes[0] & 0xFF;
//	addr |= ((bytes[1] << 8) & 0xFF00);
//	addr |= ((bytes[2] << 16) & 0xFF0000);
//	addr |= ((bytes[3] << 24) & 0xFF000000);
//	return addr;
//}

CCDialogIO_OnLine::CCDialogIO_OnLine(CWnd* pParent /*=NULL*/)
	: CDialogEx(CCDialogIO_OnLine::IDD, pParent)
{

}

CCDialogIO_OnLine::~CCDialogIO_OnLine()
{
}

void CCDialogIO_OnLine::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	//  DDX_Control(pDX, IDC_BUTTON_FAN, m_Check0_0);
	DDX_Control(pDX, IDC_BUTTON_FAN, m_Check_Fan);
	DDX_Control(pDX, IDC_LIST_SHOW, m_ListShow2);
}


BEGIN_MESSAGE_MAP(CCDialogIO_OnLine, CDialogEx)
	//ON_BN_CLICKED(IDC_BUTTON_FAN, &CCDialogIO_OnLine::OnBnClickedButtonFan)
	ON_WM_CLOSE()
	/*ON_BN_CLICKED(IDC_CHECK_FAN, &CCDialogIO_OnLine::OnBnClickedCheckFan)
	ON_BN_CLICKED(IDC_CHECK_BUTTON_LIGHT_START, &CCDialogIO_OnLine::OnBnClickedCheckButtonLightStart)
	ON_BN_CLICKED(IDC_CHECK_BUTTON_LIGHT_RESET, &CCDialogIO_OnLine::OnBnClickedCheckButtonLightReset)
	ON_BN_CLICKED(IDC_CHECK_RED_LIGHT, &CCDialogIO_OnLine::OnBnClickedCheckRedLight)
	ON_BN_CLICKED(IDC_CHECK_YELLOW_LIGHT, &CCDialogIO_OnLine::OnBnClickedCheckYellowLight)
	ON_BN_CLICKED(IDC_CHECK_GREEN_LIGHT, &CCDialogIO_OnLine::OnBnClickedCheckGreenLight)
	ON_BN_CLICKED(IDC_CHECK_BLUE_LIGHT, &CCDialogIO_OnLine::OnBnClickedCheckBlueLight)
	ON_BN_CLICKED(IDC_CHECK_BUZZING, &CCDialogIO_OnLine::OnBnClickedCheckBuzzing)*/
	ON_MESSAGE(WM_SOCKET2, OnSocket2)
	/*ON_BN_CLICKED(IDC_CHECK_CONVEYER1, &CCDialogIO_OnLine::OnBnClickedCheckConveyer1)
	ON_BN_CLICKED(IDC_CHECK_CONVEYER2, &CCDialogIO_OnLine::OnBnClickedCheckConveyer2)
	ON_BN_CLICKED(IDC_CHECK_BLOW1, &CCDialogIO_OnLine::OnBnClickedCheckBlow1)
	ON_BN_CLICKED(IDC_CHECK_BLOW2, &CCDialogIO_OnLine::OnBnClickedCheckBlow2)
	ON_BN_CLICKED(IDC_CHECK_BLOW3, &CCDialogIO_OnLine::OnBnClickedCheckBlow3)
	ON_BN_CLICKED(IDC_CHECK_BLOW2_1, &CCDialogIO_OnLine::OnBnClickedCheckBlow21)
	ON_BN_CLICKED(IDC_CHECK_BLOW2_2, &CCDialogIO_OnLine::OnBnClickedCheckBlow22)
	ON_BN_CLICKED(IDC_CHECK_VISION1_TRIGGER, &CCDialogIO_OnLine::OnBnClickedCheckVision1Trigger)
	ON_EN_CHANGE(IDC_EDIT_UP_MODEL_BEGION_POS, &CCDialogIO_OnLine::OnEnChangeEditUpModelBegionPos)
	ON_EN_CHANGE(IDC_EDIT_DOWN_MODEL_BEGION_POS, &CCDialogIO_OnLine::OnEnChangeEditDownModelBegionPos)
	ON_EN_CHANGE(IDC_EDIT_DUST_WAIT_TIME, &CCDialogIO_OnLine::OnEnChangeEditDustWaitTime)
	ON_EN_CHANGE(IDC_EDIT_DUST_TIME_BLOW, &CCDialogIO_OnLine::OnEnChangeEditDustTimeBlow)
	ON_EN_CHANGE(IDC_EDIT_DUST_INTERVAL_BLOW, &CCDialogIO_OnLine::OnEnChangeEditDustIntervalBlow)
	ON_EN_CHANGE(IDC_EDIT_WORKPIECE1_WAIT_TIME, &CCDialogIO_OnLine::OnEnChangeEditWorkpiece1WaitTime)
	ON_EN_CHANGE(IDC_EDIT_WORKPIECE1_BLOW_CONTINUE_TIME, &CCDialogIO_OnLine::OnEnChangeEditWorkpiece1BlowContinueTime)
	ON_EN_CHANGE(IDC_EDIT__WORKPIECE2_WAIT_TIME, &CCDialogIO_OnLine::OnEnChangeEdit)
	ON_EN_CHANGE(IDC_EDIT_WORKPIECE2_BLOW_CONTINUE_TIME, &CCDialogIO_OnLine::OnEnChangeEditWorkpiece2BlowContinueTime)
	ON_EN_CHANGE(IDC_EDIT_LIMIT_CONTINUE_TIME, &CCDialogIO_OnLine::OnEnChangeEditLimitContinueTime)
	ON_EN_CHANGE(IDC_EDIT_UP_DISTANCE, &CCDialogIO_OnLine::OnEnChangeEditUpDistance)
	ON_EN_CHANGE(IDC_EDIT_DOWN_DISTANCE, &CCDialogIO_OnLine::OnEnChangeEditDownDistance)
	ON_EN_CHANGE(IDC_EDIT_DOWN_PUSH_DISTANCE, &CCDialogIO_OnLine::OnEnChangeEditDownPushDistance)
	ON_EN_CHANGE(IDC_EDIT_CONTINUE_NG_NUMBER, &CCDialogIO_OnLine::OnEnChangeEditContinueNgNumber)
	ON_BN_CLICKED(IDC_CHECK_VISION2_TRIGGRE, &CCDialogIO_OnLine::OnBnClickedCheckVision2Triggre)
	ON_BN_CLICKED(IDC_CHECK_UP_ALARM_RESET, &CCDialogIO_OnLine::OnBnClickedCheckUpAlarmReset)
	ON_BN_CLICKED(IDC_CHECK_DOWN_ALARM_RESET, &CCDialogIO_OnLine::OnBnClickedCheckDownAlarmReset)
	ON_BN_CLICKED(IDC_CHECK_ROTATE, &CCDialogIO_OnLine::OnBnClickedCheckRotate)
	ON_BN_CLICKED(IDC_CHECK_INHALE, &CCDialogIO_OnLine::OnBnClickedCheckInhale)
	ON_BN_CLICKED(IDC_CHECK_CLAMP, &CCDialogIO_OnLine::OnBnClickedCheckClamp)
	ON_BN_CLICKED(IDC_CHECK_CYLINDER1_EXCHANGE, &CCDialogIO_OnLine::OnBnClickedCheckCylinder1Exchange)
	ON_BN_CLICKED(IDC_CHECK_CYLINDER2_EXCHANGE, &CCDialogIO_OnLine::OnBnClickedCheckCylinder2Exchange)
	ON_BN_CLICKED(IDC_CHECK_CONVEYER3, &CCDialogIO_OnLine::OnBnClickedCheckConveyer3)
	ON_BN_CLICKED(IDC_CHECK_CONVEYER4, &CCDialogIO_OnLine::OnBnClickedCheckConveyer4)
	ON_BN_CLICKED(IDC_CHECK_CONVEYER5, &CCDialogIO_OnLine::OnBnClickedCheckConveyer5)
	ON_BN_CLICKED(IDC_CHECK_GET_ELEC, &CCDialogIO_OnLine::OnBnClickedCheckGetElec)
	ON_BN_CLICKED(IDC_CHECK_GET_ELEC2, &CCDialogIO_OnLine::OnBnClickedCheckGetElec2)
	ON_BN_CLICKED(IDC_CHECK_GET_ELEC3, &CCDialogIO_OnLine::OnBnClickedCheckGetElec3)
	ON_BN_CLICKED(IDC_CHECK_GET_ELEC4, &CCDialogIO_OnLine::OnBnClickedCheckGetElec4)
	ON_BN_CLICKED(IDC_CHECK_GET_ELEC5, &CCDialogIO_OnLine::OnBnClickedCheckGetElec5)
	ON_BN_CLICKED(IDC_CHECK_BLOW4, &CCDialogIO_OnLine::OnBnClickedCheckBlow4)
	ON_BN_CLICKED(IDC_CHECK_SELECT_MANUAL, &CCDialogIO_OnLine::OnBnClickedCheckSelectManual)
	ON_BN_CLICKED(IDC_CHECK_SELECT_OFFLINE, &CCDialogIO_OnLine::OnBnClickedCheckSelectOffline)
	ON_BN_CLICKED(IDC_CHECK_STACK, &CCDialogIO_OnLine::OnBnClickedCheckStack)
	ON_BN_CLICKED(IDC_CHECK_SELECT_BIG_CUP, &CCDialogIO_OnLine::OnBnClickedCheckSelectBigCup)
	ON_BN_CLICKED(IDC_CHECK_VISION_RESET_FINISHED, &CCDialogIO_OnLine::OnBnClickedCheckVisionResetFinished)
	ON_BN_CLICKED(IDC_CHECK_INSPECT_CUP_NUM_ZERO, &CCDialogIO_OnLine::OnBnClickedCheckInspectCupNumZero)
	ON_BN_CLICKED(IDC_CHECK_STACK_CUP_NUM_ZERO, &CCDialogIO_OnLine::OnBnClickedCheckStackCupNumZero)
	ON_BN_CLICKED(IDC_CHECK_DETECT1_OK, &CCDialogIO_OnLine::OnBnClickedCheckDetect1Ok)
	ON_BN_CLICKED(IDC_CHECK_DETECT1_NG, &CCDialogIO_OnLine::OnBnClickedCheckDetect1Ng)
	ON_BN_CLICKED(IDC_CHECK_DETECT2_OK, &CCDialogIO_OnLine::OnBnClickedCheckDetect2Ok)
	ON_BN_CLICKED(IDC_CHECK_DETECT2_NG, &CCDialogIO_OnLine::OnBnClickedCheckDetect2Ng)*/
	ON_BN_CLICKED(IDC_BUTTON_DEFAULT, &CCDialogIO_OnLine::OnBnClickedButtonDefault)
	ON_BN_CLICKED(IDC_BUTTON_SAVE_PARAM, &CCDialogIO_OnLine::OnBnClickedButtonSaveParam)
	ON_BN_CLICKED(IDC_BUTTON_SEND, &CCDialogIO_OnLine::OnBnClickedButtonSend)
	ON_WM_TIMER()
	ON_EN_CHANGE(IDC_EDIT_DishArrive_WaitTime, &CCDialogIO_OnLine::OnEnChangeEditDisharriveWaittime)
	//ON_EN_CHANGE(IDC_EDIT_ContinueTime_Blow, &CCDialogIO_OnLine::OnEnChangeEditContinuetimeBlow)
	ON_EN_CHANGE(IDC_EDIT_WaitTime_Inhale, &CCDialogIO_OnLine::OnEnChangeEditWaittimeInhale)
	ON_EN_CHANGE(IDC_EDIT_ContinueTime_Inhale, &CCDialogIO_OnLine::OnEnChangeEditContinuetimeInhale)
	ON_EN_CHANGE(IDC_EDIT_Motor_Speed, &CCDialogIO_OnLine::OnEnChangeEditMotorSpeed)
	ON_EN_CHANGE(IDC_EDIT_Num_SingleChannel, &CCDialogIO_OnLine::OnEnChangeEditNumSinglechannel)
	ON_EN_CHANGE(IDC_EDIT_1to2_WaitTime, &CCDialogIO_OnLine::OnEnChangeEdit1to2Waittime)
	ON_EN_CHANGE(IDC_EDIT_1to2_ContinueTime, &CCDialogIO_OnLine::OnEnChangeEdit1to2Continuetime)
	ON_EN_CHANGE(IDC_IEDIT_2to4_1_WaitTime, &CCDialogIO_OnLine::OnEnChangeIedit2to41Waittime)
	ON_EN_CHANGE(IDC_EDIT_2to4_1_ContinueTime, &CCDialogIO_OnLine::OnEnChangeEdit2to41Continuetime)
	//ON_EN_CHANGE(IDC_EDIT_2to4_2_WaitTime, &CCDialogIO_OnLine::OnEnChangeEdit2to42Waittime)
	//ON_EN_CHANGE(IDC_EDIT_2to4_2_ContinueTime, &CCDialogIO_OnLine::OnEnChangeEdit2to42Continuetime)
	ON_BN_CLICKED(IDC_CHECK_00, &CCDialogIO_OnLine::OnBnClickedCheck00)
	ON_BN_CLICKED(IDC_CHECK_01, &CCDialogIO_OnLine::OnBnClickedCheck01)
	ON_BN_CLICKED(IDC_CHECK_Conveyer_run, &CCDialogIO_OnLine::OnBnClickedCheckConveyerrun)
	ON_BN_CLICKED(IDC_CHECK_Light_RUN, &CCDialogIO_OnLine::OnBnClickedCheckLightRun)
	ON_BN_CLICKED(IDC_CHECK_Light_Reset, &CCDialogIO_OnLine::OnBnClickedCheckLightReset)
	ON_BN_CLICKED(IDC_CHECK_Light_Red, &CCDialogIO_OnLine::OnBnClickedCheckLightRed)
	ON_BN_CLICKED(IDC_CHECK_Light_Yellow, &CCDialogIO_OnLine::OnBnClickedCheckLightYellow)
	ON_BN_CLICKED(IDC_CHECK_Light_Green, &CCDialogIO_OnLine::OnBnClickedCheckLightGreen)
	ON_BN_CLICKED(IDC_CHECK_Light_Blue, &CCDialogIO_OnLine::OnBnClickedCheckLightBlue)
	ON_BN_CLICKED(IDC_CHECK_Buzz, &CCDialogIO_OnLine::OnBnClickedCheckBuzz)
	ON_BN_CLICKED(IDC_CHECK_Conveyor1_run, &CCDialogIO_OnLine::OnBnClickedCheckConveyor1run)
	ON_BN_CLICKED(IDC_CHECK_Conveyor2_run, &CCDialogIO_OnLine::OnBnClickedCheckConveyor2run)
	ON_BN_CLICKED(IDC_CHECK_BLOW_Dust, &CCDialogIO_OnLine::OnBnClickedCheckBlowDust)
	ON_BN_CLICKED(IDC_CHECK_Blow_Stuff, &CCDialogIO_OnLine::OnBnClickedCheckBlowStuff)
	ON_BN_CLICKED(IDC_CHECK_SF_On, &CCDialogIO_OnLine::OnBnClickedCheckSfOn)
	ON_BN_CLICKED(IDC_CHECK_SF_Alarm_Reset, &CCDialogIO_OnLine::OnBnClickedCheckSfAlarmReset)
	ON_BN_CLICKED(IDC_CHECK_Unpack_Inhale, &CCDialogIO_OnLine::OnBnClickedCheckUnpackInhale)
	ON_BN_CLICKED(IDC_CHECK_Unpack_Blow, &CCDialogIO_OnLine::OnBnClickedCheckUnpackBlow)
	ON_BN_CLICKED(IDC_CHECK_1to2_Blow, &CCDialogIO_OnLine::OnBnClickedCheck1to2Blow)
	ON_BN_CLICKED(IDC_CHECK_2to4_1_Blow, &CCDialogIO_OnLine::OnBnClickedCheck2to41Blow)
	ON_BN_CLICKED(IDC_CHECK_2to4_2_Blow, &CCDialogIO_OnLine::OnBnClickedCheck2to42Blow)
	ON_BN_CLICKED(IDC_CHECK_Manual, &CCDialogIO_OnLine::OnBnClickedCheckManual)
	ON_BN_CLICKED(IDC_CHECK_Communicate, &CCDialogIO_OnLine::OnBnClickedCheckCommunicate)
	ON_BN_CLICKED(IDC_CHECK_Vision1_OK, &CCDialogIO_OnLine::OnBnClickedCheckVision1Ok)
	ON_BN_CLICKED(IDC_CHECK_Vision1_Ng, &CCDialogIO_OnLine::OnBnClickedCheckVision1Ng)
	ON_BN_CLICKED(IDC_CHECK_Vision2_OK, &CCDialogIO_OnLine::OnBnClickedCheckVision2Ok)
	ON_BN_CLICKED(IDC_CHECK_VISION2_NG, &CCDialogIO_OnLine::OnBnClickedCheckVision2Ng)
	ON_EN_CHANGE(IDC_EDIT_ContinueNGNUM, &CCDialogIO_OnLine::OnEnChangeEditContinuengnum)
	ON_EN_CHANGE(IDC_EDIT_Unpack_InhaleRate, &CCDialogIO_OnLine::OnEnChangeEditUnpackInhalerate)
	ON_EN_CHANGE(IDC_EDIT_Continue_Blow_time, &CCDialogIO_OnLine::OnEnChangeEditContinueBlowtime)
	ON_BN_CLICKED(IDC_CHECK_Run, &CCDialogIO_OnLine::OnBnClickedCheckRun)
	ON_BN_CLICKED(IDC_CHECK_Clear_Block, &CCDialogIO_OnLine::OnBnClickedCheckClearBlock)
	/*ON_EN_CHANGE(IDC_EDIT_Unpack_InhaleRate1, &CCDialogIO_OnLine::OnEnChangeEditUnpackInhalerate1)
	ON_EN_CHANGE(IDC_EDIT_Unpack_InhaleRate2, &CCDialogIO_OnLine::OnEnChangeEditUnpackInhalerate2)
	ON_EN_CHANGE(IDC_EDIT_Unpack_InhaleRate3, &CCDialogIO_OnLine::OnEnChangeEditUnpackInhalerate3)*/
	//ON_EN_CHANGE(IDC_EDIT_OK2_Delay_time, &CCDialogIO_OnLine::OnEnChangeEditOk2Delaytime)
	ON_EN_CHANGE(IDC_EDIT_OK1_Delay_time, &CCDialogIO_OnLine::OnEnChangeEditOk1Delaytime)
	ON_EN_CHANGE(IDC_EDIT_Block_Time, &CCDialogIO_OnLine::OnEnChangeEditBlockTime)
	ON_BN_CLICKED(IDC_CHECK_OK, &CCDialogIO_OnLine::OnBnClickedCheckOk)
	ON_BN_CLICKED(IDC_CHECK_NG, &CCDialogIO_OnLine::OnBnClickedCheckNg)
	ON_BN_CLICKED(IDC_CHECK_Manual2, &CCDialogIO_OnLine::OnBnClickedCheckManual2)
	ON_BN_CLICKED(IDC_CHECK_OK2, &CCDialogIO_OnLine::OnBnClickedCheckOk2)
	ON_BN_CLICKED(IDC_CHECK_Clear_Block2, &CCDialogIO_OnLine::OnBnClickedCheckClearBlock2)
	ON_BN_CLICKED(IDC_CHECK_OK3, &CCDialogIO_OnLine::OnBnClickedCheckOk3)
	ON_BN_CLICKED(IDC_CHECK_OK4, &CCDialogIO_OnLine::OnBnClickedCheckOk4)
	ON_BN_CLICKED(IDC_CHECK_OK5, &CCDialogIO_OnLine::OnBnClickedCheckOk5)
	ON_BN_CLICKED(IDC_CHECK_NG2, &CCDialogIO_OnLine::OnBnClickedCheckNg2)
	//ON_EN_CHANGE(IDC_EDIT1, &CCDialogIO_OnLine::OnEnChangeEdit1)
	ON_EN_CHANGE(IDC_EDIT2, &CCDialogIO_OnLine::OnEnChangeEdit2)
	ON_EN_CHANGE(IDC_EDIT3, &CCDialogIO_OnLine::OnEnChangeEdit3)
	ON_EN_CHANGE(IDC_EDIT4, &CCDialogIO_OnLine::OnEnChangeEdit4)
	ON_EN_CHANGE(IDC_EDIT10, &CCDialogIO_OnLine::OnEnChangeEdit10)
	ON_EN_CHANGE(IDC_EDIT11, &CCDialogIO_OnLine::OnEnChangeEdit11)
	ON_EN_CHANGE(IDC_EDIT12, &CCDialogIO_OnLine::OnEnChangeEdit12)
	ON_EN_CHANGE(IDC_EDIT5, &CCDialogIO_OnLine::OnEnChangeEdit5)
	ON_EN_CHANGE(IDC_EDIT14, &CCDialogIO_OnLine::OnEnChangeEdit14)
	ON_EN_CHANGE(IDC_EDIT15, &CCDialogIO_OnLine::OnEnChangeEdit15)
	ON_EN_CHANGE(IDC_EDIT_567, &CCDialogIO_OnLine::OnEnChangeEdit567)
	ON_EN_CHANGE(IDC_EDIT16, &CCDialogIO_OnLine::OnEnChangeEdit16)
	ON_EN_CHANGE(IDC_PackOK_DelayBlowTime, &CCDialogIO_OnLine::OnEnChangePackokDelayblowtime)
	//ON_EN_CHANGE(IDC_PackOK_BlowTime, &CCDialogIO_OnLine::OnEnChangePackokBlowtime)
	ON_EN_CHANGE(IDC_EDIT_PACKOK_blowTime, &CCDialogIO_OnLine::OnEnChangeEditPackokblowtime)
	ON_EN_CHANGE(IDC_Row, &CCDialogIO_OnLine::OnEnChangeRow)
	ON_EN_CHANGE(IDC_OKPush_DelayTime, &CCDialogIO_OnLine::OnEnChangeOkpushDelaytime)
	ON_EN_CHANGE(IDC_PackInhale_DelayTime, &CCDialogIO_OnLine::OnEnChangePackinhaleDelaytime)
	ON_EN_CHANGE(IDC_PackInhale_ContinueTime, &CCDialogIO_OnLine::OnEnChangePackinhaleContinuetime)
	ON_EN_CHANGE(IDC_PackPush_DelayTime, &CCDialogIO_OnLine::OnEnChangePackpushDelaytime)
	ON_EN_CHANGE(IDC_PackPush_CylinderSpreadTime, &CCDialogIO_OnLine::OnEnChangePackpushCylinderspreadtime)
	ON_EN_CHANGE(IDC_spare1, &CCDialogIO_OnLine::OnEnChangespare1)
	ON_EN_CHANGE(IDC_spare2, &CCDialogIO_OnLine::OnEnChangespare2)
	ON_EN_CHANGE(IDC_PackInhale_ContinueTime2, &CCDialogIO_OnLine::OnEnChangePackinhaleContinuetime2)
	ON_EN_CHANGE(IDC_new_spare1, &CCDialogIO_OnLine::OnEnChangenewspare1)
	ON_EN_CHANGE(IDC_new_spare2, &CCDialogIO_OnLine::OnEnChangenewspare2)
	ON_EN_CHANGE(IDC_new_spare3, &CCDialogIO_OnLine::OnEnChangenewspare3)
	ON_EN_CHANGE(IDC_new_spare4, &CCDialogIO_OnLine::OnEnChangenewspare4)
	ON_EN_CHANGE(IDC_new_spare5, &CCDialogIO_OnLine::OnEnChangenewspare5)
	ON_EN_CHANGE(IDC_new_spare6, &CCDialogIO_OnLine::OnEnChangenewspare6)
	ON_EN_CHANGE(IDC_spare11, &CCDialogIO_OnLine::OnEnChangespare11)
	ON_EN_CHANGE(IDC_spare22, &CCDialogIO_OnLine::OnEnChangespare22)
	ON_EN_CHANGE(IDC_spare33, &CCDialogIO_OnLine::OnEnChangespare33)
	//		ON_EN_CHANGE(IDC_spare44, &CCDialogIO_OnLine::OnEnChangespare44)
	ON_EN_CHANGE(IDC_spare55, &CCDialogIO_OnLine::OnEnChangespare55)
	ON_EN_CHANGE(IDC_spare66, &CCDialogIO_OnLine::OnEnChangespare66)
	ON_WM_RBUTTONDBLCLK()
	ON_BN_CLICKED(IDC_CHECK1, &CCDialogIO_OnLine::OnBnClickedCheck1)
	ON_BN_CLICKED(IDC_CHECK2, &CCDialogIO_OnLine::OnBnClickedCheck2)
	ON_EN_CHANGE(IDC_spare77, &CCDialogIO_OnLine::OnEnChangespare77)
	ON_EN_CHANGE(IDC_spare88, &CCDialogIO_OnLine::OnEnChangespare88)
	ON_EN_CHANGE(IDC_spare99, &CCDialogIO_OnLine::OnEnChangespare99)
	ON_BN_CLICKED(IDC_CHECK3, &CCDialogIO_OnLine::OnBnClickedCheck3)
	ON_EN_CHANGE(IDC_spare44, &CCDialogIO_OnLine::OnEnChangespare44)
END_MESSAGE_MAP()


// CCDialogIO_OnLine 消息处理程序
BOOL CCDialogIO_OnLine::OnInitDialog()
{
	CDialogEx::OnInitDialog();
	CString str;

	char tmpstr[MAX_PATH];
	CString strTemp;
	CDefectInspectionSystemDlg* pDia = CDefectInspectionSystemDlg::s_pDialog;
#pragma region PLC
	//14-15
	GetPrivateProfileString("PLC", "CONTINUE_NG_NUMBER", "252", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.nCONTINUE_NG_NUMBER = atoi(tmpstr);
	//16-17
	GetPrivateProfileString("PLC", "Block_Time", "30", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.nBlock_Time = atoi(tmpstr);
	//18-19
	GetPrivateProfileString("PLC", "Sensor_Miss_Trigger_Time", "2000", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.nSensor_Miss_Trigger_Time = atoi(tmpstr);
	//20-21
	GetPrivateProfileString("PLC", "Vision1_FeedBack_Time", "30", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.nVision1_FeedBack_Time = atoi(tmpstr);
	//22-23
	GetPrivateProfileString("PLC", "Vision2_FeedBack_Time", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.nVision2_FeedBack_Time = atoi(tmpstr);



	//24-25
	GetPrivateProfileString("PLC", "Unpack_Block_Time", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.Unpack_Block_Time = atoi(tmpstr);
	//26-27
	GetPrivateProfileString("PLC", "Length_Product", "2", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.Length_Product = atof(tmpstr);
	//28-29
	GetPrivateProfileString("PLC", "Rate_Product", "2", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.Rate_Product = atof(tmpstr);
	//30-31
	GetPrivateProfileString("PLC", "Space_Product", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.Space_Product = atof(tmpstr);
	//32-33
	GetPrivateProfileString("PLC", "Pack_Sucker1_Inhale", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.Pack_Sucker1_Inhale = atof(tmpstr);
	//36-37
	GetPrivateProfileString("PLC", "Pack_Sucker2_Inhale", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.Pack_Sucker2_Inhale = atof(tmpstr);
	//40-41
	GetPrivateProfileString("PLC", "Pack_Sucker2_Inhale_Wait", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.Pack_Sucker2_Inhale_Wait = atof(tmpstr);
	//44-45
	GetPrivateProfileString("PLC", "Number_Single_Line", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.Number_Single_Line = atoi(tmpstr);

	GetPrivateProfileString("PLC", "PackOK_DelayBlowTime", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.PackOK_DelayBlowTime = atoi(tmpstr);
	GetPrivateProfileString("PLC", "PackOK_BlowTime", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.PackOK_BlowTime = atoi(tmpstr);

	GetPrivateProfileString("PLC", "Row", "4", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.Row = atoi(tmpstr);

	GetPrivateProfileString("PLC", "OKPush_DelayTime", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.OKPush_DelayTime = atoi(tmpstr);

	GetPrivateProfileString("PLC", "PackInhale_DelayTime", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.PackInhale_DelayTime = atoi(tmpstr);
	GetPrivateProfileString("PLC", "PackInhale_ContinueTime", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.PackInhale_ContinueTime = atoi(tmpstr);
	GetPrivateProfileString("PLC", "PackPush_DelayTime", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.PackPush_DelayTime = atoi(tmpstr);
	GetPrivateProfileString("PLC", "PackPush_CylinderSpreadTime", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.PackPush_CylinderSpreadTime = atoi(tmpstr);

	GetPrivateProfileString("PLC", "spare1", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.spare1 = atoi(tmpstr);
	GetPrivateProfileString("PLC", "spare2", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.spare2 = atoi(tmpstr);

	GetPrivateProfileString("PLC", "new_spare1", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.new_spare1 = atoi(tmpstr);
	GetPrivateProfileString("PLC", "new_spare2", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.new_spare2 = atoi(tmpstr);
	GetPrivateProfileString("PLC", "new_spare3", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.new_spare3 = atoi(tmpstr);
	GetPrivateProfileString("PLC", "new_spare4", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.new_spare4 = atoi(tmpstr);
	GetPrivateProfileString("PLC", "new_spare5", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.new_spare5 = atoi(tmpstr);
	GetPrivateProfileString("PLC", "new_spare6", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.new_spare6 = atoi(tmpstr);

	GetPrivateProfileString("PLC", "new_spare11", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.new_spare11 = atoi(tmpstr);
	GetPrivateProfileString("PLC", "new_spare22", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.new_spare22 = atof(tmpstr);//
	GetPrivateProfileString("PLC", "new_spare33", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.new_spare33 = atoi(tmpstr);
	GetPrivateProfileString("PLC", "new_spare44", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.new_spare44 = atoi(tmpstr);
	GetPrivateProfileString("PLC", "new_spare55", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.new_spare55 = atoi(tmpstr);
	GetPrivateProfileString("PLC", "new_spare66", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.new_spare66 = atoi(tmpstr);
	GetPrivateProfileString("PLC", "new_spare77", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.new_spare77 = atoi(tmpstr);
	GetPrivateProfileString("PLC", "new_spare88", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.new_spare88 = atoi(tmpstr);
	GetPrivateProfileString("PLC", "new_spare99", "40", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	theApp.new_spare99 = atoi(tmpstr);


	theApp.int2bytes(theApp.nCONTINUE_NG_NUMBER, theApp.text, 14);
	theApp.int2bytes(theApp.nBlock_Time, theApp.text, 16);
	theApp.int2bytes(theApp.nSensor_Miss_Trigger_Time, theApp.text, 18);
	theApp.int2bytes(theApp.nVision1_FeedBack_Time, theApp.text, 20);
	theApp.int2bytes(theApp.nVision2_FeedBack_Time, theApp.text, 22);//
	theApp.int2bytes(theApp.Number_Single_Line, theApp.text, 24);
	theApp.int2bytes(theApp.Length_Product * 100, theApp.text, 26);//
	theApp.int2bytes(theApp.Rate_Product * 100, theApp.text, 28);//
	theApp.int2bytes(theApp.Space_Product * 100, theApp.text, 30);//
	theApp.int2bytes(theApp.Pack_Sucker1_Inhale * 100, theApp.text, 32);
	theApp.int2bytes(theApp.Pack_Sucker2_Inhale * 100, theApp.text, 36);
	theApp.int2bytes(theApp.Pack_Sucker2_Inhale_Wait * 100, theApp.text, 40);
	theApp.int2bytes(theApp.Number_Single_Line, theApp.text, 44);

	theApp.int2bytes(theApp.PackOK_DelayBlowTime, theApp.text, 48);
	theApp.int2bytes(theApp.PackOK_BlowTime, theApp.text, 50);

	theApp.int2bytes(theApp.Row, theApp.text, 52);
	theApp.int2bytes(theApp.OKPush_DelayTime, theApp.text, 54);

	theApp.int2bytes(theApp.PackInhale_DelayTime, theApp.text, 56);
	theApp.int2bytes(theApp.PackInhale_ContinueTime, theApp.text, 58);
	theApp.int2bytes(theApp.PackPush_DelayTime, theApp.text, 60);
	theApp.int2bytes(theApp.PackPush_CylinderSpreadTime, theApp.text, 62);
	theApp.int2bytes(theApp.spare1, theApp.text, 64);
	theApp.int2bytes(theApp.spare2, theApp.text, 66);

	theApp.int2bytes(theApp.new_spare1, theApp.text, 68);
	theApp.int2bytes(theApp.new_spare2, theApp.text, 70);
	theApp.int2bytes(theApp.new_spare3, theApp.text, 72);
	theApp.int2bytes(theApp.new_spare4, theApp.text, 74);
	theApp.int2bytes(theApp.new_spare5 * 10, theApp.text, 76);
	theApp.int2bytes(theApp.new_spare6, theApp.text, 78);

	theApp.int2bytes(theApp.new_spare11, theApp.text, 80);
	theApp.int2bytes(theApp.new_spare22 * 10, theApp.text, 82);
	theApp.int2bytes(theApp.new_spare33, theApp.text, 84);
	theApp.int2bytes(theApp.new_spare44, theApp.text, 86);
	theApp.int2bytes(theApp.new_spare55, theApp.text, 88);
	theApp.int2bytes(theApp.new_spare66, theApp.text, 90);
	theApp.int2bytes(theApp.new_spare77, theApp.text, 92);
	theApp.int2bytes(theApp.new_spare88, theApp.text, 94);
	theApp.int2bytes(theApp.new_spare99, theApp.text, 96);
#pragma endregion'PLC'


	str.Format("%d", theApp.nCONTINUE_NG_NUMBER);//
	SetDlgItemText(IDC_EDIT_DishArrive_WaitTime, str);

	str.Format("%d", theApp.nBlock_Time);
	SetDlgItemText(IDC_EDIT_Continue_Blow_time, str);

	str.Format("%d", theApp.nSensor_Miss_Trigger_Time);//IDC_EDIT_DUST_WAIT_TIME
	SetDlgItemText(IDC_EDIT_WaitTime_Inhale, str);

	str.Format("%d", theApp.nVision1_FeedBack_Time);
	SetDlgItemText(IDC_EDIT_ContinueTime_Inhale, str);

	str.Format("%d", theApp.nVision2_FeedBack_Time);
	SetDlgItemText(IDC_EDIT_Motor_Speed, str);

	str.Format("%d", theApp.Unpack_Block_Time);
	SetDlgItemText(IDC_EDIT_Num_SingleChannel, str);

	str.Format("%.2f", theApp.Length_Product);
	SetDlgItemText(IDC_EDIT_1to2_WaitTime, str);

	str.Format("%.2f", theApp.Rate_Product);
	SetDlgItemText(IDC_EDIT_1to2_ContinueTime, str);

	str.Format("%.2f", theApp.Space_Product);
	SetDlgItemText(IDC_IEDIT_2to4_1_WaitTime, str);

	str.Format("%.2f", theApp.Pack_Sucker1_Inhale);
	SetDlgItemText(IDC_EDIT_2to4_1_ContinueTime, str);

	str.Format("%.2f", theApp.Pack_Sucker2_Inhale);
	SetDlgItemText(IDC_EDIT_OK1_Delay_time, str);

	str.Format("%.2f", theApp.Pack_Sucker2_Inhale_Wait);
	SetDlgItemText(IDC_EDIT16, str);//IDC_EDIT_OK2_Delay_time

	str.Format("%d", theApp.Number_Single_Line);
	SetDlgItemText(IDC_EDIT_Block_Time, str);


	str.Format("%d", theApp.PackOK_DelayBlowTime);
	SetDlgItemText(IDC_PackOK_DelayBlowTime, str);
	str.Format("%d", theApp.PackOK_BlowTime);
	SetDlgItemText(IDC_EDIT_PACKOK_blowTime, str);

	//52-53
	str.Format("%d", theApp.Row);
	SetDlgItemText(IDC_Row, str);
	//54-55
	str.Format("%d", theApp.OKPush_DelayTime);
	SetDlgItemText(IDC_OKPush_DelayTime, str);

	//56-57
	str.Format("%d", theApp.PackInhale_DelayTime);
	SetDlgItemText(IDC_PackInhale_DelayTime, str);
	str.Format("%d", theApp.PackInhale_ContinueTime);
	SetDlgItemText(IDC_PackInhale_ContinueTime2, str);

	str.Format("%d", theApp.PackPush_DelayTime);
	SetDlgItemText(IDC_PackPush_DelayTime, str);
	str.Format("%d", theApp.PackPush_CylinderSpreadTime);
	SetDlgItemText(IDC_PackPush_CylinderSpreadTime, str);

	str.Format("%d", theApp.spare1);
	SetDlgItemText(IDC_spare1, str);
	str.Format("%d", theApp.spare2);
	SetDlgItemText(IDC_spare2, str);

	str.Format("%d", theApp.new_spare1);
	SetDlgItemText(IDC_new_spare1, str);
	str.Format("%d", theApp.new_spare2);
	SetDlgItemText(IDC_new_spare2, str);
	str.Format("%d", theApp.new_spare3);
	SetDlgItemText(IDC_new_spare3, str);
	str.Format("%d", theApp.new_spare4);
	SetDlgItemText(IDC_new_spare4, str);
	str.Format("%.1f", theApp.new_spare5);
	SetDlgItemText(IDC_new_spare5, str);
	str.Format("%d", theApp.new_spare6);
	SetDlgItemText(IDC_new_spare6, str);

	str.Format("%d", theApp.new_spare11);
	SetDlgItemText(IDC_spare11, str);
	str.Format("%.1f", theApp.new_spare22);
	SetDlgItemText(IDC_spare22, str);
	str.Format("%d", theApp.new_spare33);
	SetDlgItemText(IDC_spare33, str);
	str.Format("%d", theApp.new_spare44);
	SetDlgItemText(IDC_spare44, str);
	str.Format("%d", theApp.new_spare55);
	SetDlgItemText(IDC_spare55, str);
	str.Format("%d", theApp.new_spare66);
	SetDlgItemText(IDC_spare66, str);
	str.Format("%d", theApp.new_spare77);
	SetDlgItemText(IDC_spare77, str);
	str.Format("%d", theApp.new_spare88);
	SetDlgItemText(IDC_spare88, str);
	str.Format("%d", theApp.new_spare99);
	SetDlgItemText(IDC_spare99, str);

	theApp.temp[4][1] = 0;
	theApp.temp[4][2] = 0;
	Refresh();
	//UpdateUI(true);
	SetTimer(5, 1000, NULL);
	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常:  OCX 属性页应返回 FALSE
}

bool CCDialogIO_OnLine::ReadConfingIO(CCDialogIO_OnLine* a)
{
	CString str;

	char tmpstr[MAX_PATH];
	CString strTemp;
	CDefectInspectionSystemDlg* pDia = CDefectInspectionSystemDlg::s_pDialog;
	try
	{
#pragma region PLC
		GetPrivateProfileString("PLC", "CONTINUE_NG_NUMBER", "252", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.nCONTINUE_NG_NUMBER = atoi(tmpstr);

		GetPrivateProfileString("PLC", "Block_Time", "30", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.nBlock_Time = atoi(tmpstr);

		GetPrivateProfileString("PLC", "Sensor_Miss_Trigger_Time", "2000", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.nSensor_Miss_Trigger_Time = atoi(tmpstr);

		GetPrivateProfileString("PLC", "Vision1_FeedBack_Time", "30", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.nVision1_FeedBack_Time = atoi(tmpstr);

		GetPrivateProfileString("PLC", "Vision2_FeedBack_Time", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.nVision2_FeedBack_Time = atoi(tmpstr);




		GetPrivateProfileString("PLC", "Unpack_Block_Time", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.Unpack_Block_Time = atoi(tmpstr);

		GetPrivateProfileString("PLC", "Length_Product", "2", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.Length_Product = atof(tmpstr);

		GetPrivateProfileString("PLC", "Rate_Product", "2", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.Rate_Product = atof(tmpstr);

		GetPrivateProfileString("PLC", "Space_Product", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.Space_Product = atof(tmpstr);

		GetPrivateProfileString("PLC", "Pack_Sucker1_Inhale", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.Pack_Sucker1_Inhale = atof(tmpstr);

		GetPrivateProfileString("PLC", "Pack_Sucker2_Inhale", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.Pack_Sucker2_Inhale = atof(tmpstr);

		GetPrivateProfileString("PLC", "Pack_Sucker2_Inhale_Wait", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.Pack_Sucker2_Inhale_Wait = atof(tmpstr);

		GetPrivateProfileString("PLC", "Number_Single_Line", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.Number_Single_Line = atoi(tmpstr);

		GetPrivateProfileString("PLC", "NG_Motor_Speed", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.NG_Motor_Speed = atof(tmpstr);
		GetPrivateProfileString("PLC", "OK_Motor_Speed", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.OK_Motor_Speed = atof(tmpstr);
		GetPrivateProfileString("PLC", "NG_Cylinder_Spreed_Time", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.NG_Cylinder_Spreed_Time = atoi(tmpstr);
		GetPrivateProfileString("PLC", "NG_Cylinder_Shrink_Time", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.NG_Cylinder_Shrink_Time = atoi(tmpstr);
		GetPrivateProfileString("PLC", "NG_Delay_Time", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.NG_Delay_Time = atoi(tmpstr);
		GetPrivateProfileString("PLC", "OK_Delay_Time", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.OK_Delay_Time = atoi(tmpstr);
		GetPrivateProfileString("PLC", "OK_Cylinder_Delay_Time", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.OK_Cylinder_Delay_Time = atoi(tmpstr);
		GetPrivateProfileString("PLC", "OK_Original_Position", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.OK_Original_Position = atof(tmpstr);

		GetPrivateProfileString("PLC", "Single_OK_Relative_Displacement", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.Single_OK_Relative_Displacement = atof(tmpstr);
		GetPrivateProfileString("PLC", "OK_Absolute_Displacement", "20", tmpstr, MAX_PATH, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
		theApp.OK_Absolute_Displacement = atof(tmpstr);
		//theApp.text[7] = theApp.nCONTINUE_NG_NUMBER;
		theApp.int2bytes(theApp.nCONTINUE_NG_NUMBER, theApp.text, 8);
		theApp.int2bytes(theApp.nBlock_Time, theApp.text, 12);
		theApp.int2bytes(theApp.nSensor_Miss_Trigger_Time, theApp.text, 16);
		theApp.int2bytes(theApp.nVision1_FeedBack_Time, theApp.text, 20);
		theApp.int2bytes(theApp.nVision2_FeedBack_Time, theApp.text, 24);//
		theApp.int2bytes(theApp.Number_Single_Line, theApp.text, 28);
		theApp.int2bytes(theApp.Length_Product * 100, theApp.text, 32);//
		theApp.int2bytes(theApp.Rate_Product * 100, theApp.text, 36);//
		theApp.int2bytes(theApp.Space_Product * 100, theApp.text, 40);//
		theApp.int2bytes(theApp.Pack_Sucker1_Inhale * 100, theApp.text, 44);
		theApp.int2bytes(theApp.Pack_Sucker2_Inhale * 100, theApp.text, 48);
		theApp.int2bytes(theApp.Pack_Sucker2_Inhale_Wait * 100, theApp.text, 52);
		theApp.int2bytes(theApp.Number_Single_Line, theApp.text, 56);

		theApp.int2bytes(theApp.NG_Motor_Speed * 100, theApp.text, 60);
		theApp.int2bytes(theApp.OK_Motor_Speed * 100, theApp.text, 64);
		theApp.int2bytes(theApp.NG_Cylinder_Spreed_Time, theApp.text, 68);
		theApp.int2bytes(theApp.NG_Cylinder_Shrink_Time, theApp.text, 72);
		theApp.int2bytes(theApp.NG_Delay_Time, theApp.text, 76);
		theApp.int2bytes(theApp.OK_Delay_Time, theApp.text, 80);
		theApp.int2bytes(theApp.OK_Cylinder_Delay_Time, theApp.text, 84);
		theApp.int2bytes(theApp.OK_Original_Position * 100, theApp.text, 88);
		theApp.int2bytes(theApp.Single_OK_Relative_Displacement * 100, theApp.text, 92);
		theApp.int2bytes(theApp.OK_Absolute_Displacement * 100, theApp.text, 96);
#pragma endregion'PLC'
	}
	catch (...)
	{
		return false;
	}


	//Refresh();
	return true;
}

void CCDialogIO_OnLine::BinayToDec(char* b, int* value, int size)
{
	int nint = (int)(*b);
	if (nint < 0)
	{
		nint = nint + 256;
	}
	int j = 0;
	memset(value, 0, sizeof(byte) * size);
	while (nint)
	{
		int bb = nint % 2;
		value[j] = bb;
		nint /= 2;
		j++;
	}
}

//string BinToHex(const string& strBin, bool bIsUpper = false)
//{
//	string strHex;
//	strHex.resize(strBin.size() * 2);
//	for (size_t i = 0; i < strBin.size(); i++)
//	{
//		uint8_t cTemp = strBin[i];
//		for (size_t j = 0; j < 2; j++)
//		{
//			uint8_t cCur = (cTemp & 0x0f);
//			if (cCur < 10)
//			{
//				cCur += '0';
//			}
//			else
//			{
//				cCur += ((bIsUpper ? 'A' : 'a') - 10);
//			}
//			strHex[2 * i + 1 - j] = cCur;
//			cTemp >>= 4;
//		}
//	}
//
//	return strHex;
//}
//
//int bytes2int(byte* bytes, int size)
//{
//	int iRetVal = bytes[0] & 0xFF;
//	iRetVal |= ((bytes[1] << 8) & 0xFF00);
//	iRetVal |= ((bytes[2] << 16) & 0xFF0000);
//	iRetVal |= ((bytes[3] << 24) & 0xFF000000);
//	return iRetVal;
//}
//本方法适用于(低位在前，高位在后)的顺序
int CCDialogIO_OnLine::bytesToInt3(byte* src, int offset)
{
	int value;
	value = (int)((src[offset] & 0xFF)
		| ((src[offset + 1] & 0xFF) << 8)
		| ((src[offset + 2] & 0xFF) << 16)
		| ((src[offset + 3] & 0xFF) << 24));
	return value;
}
////本方法适用于(低位在后，高位在前)的顺序
//int bytesToInt4(byte* src, int offset) {
//	int value;
//	value = (int)(((src[offset] & 0xFF) << 24)
//		| ((src[offset + 1] & 0xFF) << 16)
//		| ((src[offset + 2] & 0xFF) << 8)
//		| (src[offset + 3] & 0xFF));
//	return value;
//}
//好像用不着了
LRESULT CCDialogIO_OnLine::OnSocket2(WPARAM wParam, LPARAM lParam)
{
	sockaddr_in serveraddr;
	int len = sizeof(serveraddr);
	char buffer[102400] = { 0 };
	CString str;
	switch (lParam)
	{
		//case FD_ACCEPT:
		//{
		//	int a = theApp.m_sock_client = accept(theApp.m_sock_server, (struct sockaddr*)&serveraddr, &len);//非负描述字——成功， -1——失败
		//	str.Format("在IO内%d", a);
		//	OutputDebugString(str);
		//}
	case FD_READ:
	{
		int num = recv(theApp.m_sock_client, buffer, 102400, 0);// strlen(buffer)
		if (num > 0)
		{
			try
			{
				buffer[num] = 0;
				CString str;
				/*int num_OK1 = bytesToInt3((unsigned char*)buffer, 11);
				str.Format("\r\n%d", num_OK1);
				OutputDebugString( str);*/
				SetDlgItemInt(IDC_EDIT_SHOW2, bytesToInt3((unsigned char*)buffer, 12));
				/*int num_OK2 = bytesToInt3((unsigned char*)buffer, 15);
				str.Format("\r\n%d", num_OK2);
				OutputDebugString(str);*/
				SetDlgItemInt(IDC_EDIT_SHOW3, bytesToInt3((unsigned char*)buffer, 16));
				/*int num_OK3 = bytesToInt3((unsigned char*)buffer, 19);
				str.Format("\r\n%d", num_OK3);
				OutputDebugString(str);*/
				SetDlgItemInt(IDC_EDIT_SHOW4, bytesToInt3((unsigned char*)buffer, 20));
				SetDlgItemInt(IDC_EDIT_SHOW1, bytesToInt3((unsigned char*)buffer, 24));
				SetDlgItemInt(IDC_EDIT_SHOW6, bytesToInt3((unsigned char*)buffer, 28));
				SetDlgItemInt(IDC_EDIT_SHOW7, bytesToInt3((unsigned char*)buffer, 32));
				SetDlgItemInt(IDC_EDIT_SHOW8, bytesToInt3((unsigned char*)buffer, 36));

				str.Format("%.1f", bytesToInt3((unsigned char*)buffer, 40) / 100);
				SetDlgItemText(IDC_EDIT_SHOW5, str);

				str.Format("%.1f", bytesToInt3((unsigned char*)buffer, 44) / 100);
				SetDlgItemText(IDC_EDIT_SHOW10, str);

				str.Format("%.1f", bytesToInt3((unsigned char*)buffer, 48) / 100);
				SetDlgItemText(IDC_EDIT_SHOW11, str);

				SetDlgItemInt(IDC_EDIT_SHOW9, bytesToInt3((unsigned char*)buffer, 52));

				/*SetDlgItemInt(IDC_EDIT_NUM_OK, bytesToInt3((unsigned char*)buffer, 56));
				theApp.appNumOK = bytesToInt3((unsigned char*)buffer, 56);
				SetDlgItemInt(IDC_EDIT_NUM_NG2, bytesToInt3((unsigned char*)buffer, 60));
				theApp.appNumNG = bytesToInt3((unsigned char*)buffer, 60);*/
			}


			catch (...)
			{

			}
		}
	}
	}
	return 0;
}

void CCDialogIO_OnLine::ShowPICInfo()
{
	m_ListShow2.ResetContent();
#pragma region 字节0
	if (theApp.value[0][0] == 1)
	{
		m_ListShow2.AddString("拆垛模块_电机1原点");
	}
	if (theApp.value[0][1] == 1)
	{
		m_ListShow2.AddString("拆垛模块_伺服1报警信号");
	}
	if (theApp.value[0][2] == 1)
	{
		m_ListShow2.AddString("拆垛模块_电机2原点");
	}
	if (theApp.value[0][3] == 1)
	{
		m_ListShow2.AddString("拆垛模块_伺服2报警信号");
	}
	if (theApp.value[0][4] == 1)
	{
		m_ListShow2.AddString("急停");
	}
	if (theApp.value[0][5] == 1)
	{
		m_ListShow2.AddString("复位按钮");
	}
	if (theApp.value[0][6] == 1)
	{
		m_ListShow2.AddString("运行按钮");
	}
	if (theApp.value[0][7] == 1)
	{
		m_ListShow2.AddString("暂停按钮");
	}
#pragma endregion 字节0

#pragma region 字节1
	if (theApp.value[1][0] == 1)
	{
		m_ListShow2.AddString("停止按钮");
	}
	if (theApp.value[1][1] == 1)
	{
		m_ListShow2.AddString("检测模块_视觉1触发");
	}
	if (theApp.value[1][2] == 1)
	{
		m_ListShow2.AddString("检测模块_视觉2触发");
	}
	if (theApp.value[1][3] == 1)
	{
		m_ListShow2.AddString("检测模块_视觉3触发");
	}

	if (theApp.value[1][4] == 1)
	{
		m_ListShow2.AddString("检测模块_真空泵运行中");
	}

	if (theApp.value[1][5] == 1)
	{
		m_ListShow2.AddString("检测模块_吸尘器运行中");
	}
	if (theApp.value[1][6] == 1)
	{
		m_ListShow2.AddString("拆垛模块_缺料检测");
	}
	if (theApp.value[1][7] == 1)
	{
		m_ListShow2.AddString("码垛模块_伺服NG原点");
	}

#pragma endregion 字节1

#pragma region 字节2
	if (theApp.value[2][0] == 1)
		m_ListShow2.AddString("码垛模块_伺服NG报警信号");
	if (theApp.value[2][1] == 1)
		m_ListShow2.AddString("码垛模块_伺服OK1原点");
	if (theApp.value[2][2] == 1)
		m_ListShow2.AddString("码垛模块_伺服OK1报警信号");
	if (theApp.value[2][3] == 1)
		m_ListShow2.AddString("码垛模块_伺服OK2原点");
	if (theApp.value[2][4] == 1)
		m_ListShow2.AddString("码垛模块_伺服OK2报警信号");
	if (theApp.value[2][5] == 1)
		m_ListShow2.AddString("码垛模块_急停");
	if (theApp.value[2][6] == 1)
		m_ListShow2.AddString("码垛模块_NG料已满");
	if (theApp.value[2][7] == 1)
		m_ListShow2.AddString("码垛模块_NG剔除");
#pragma endregion 字节2

#pragma region 字节3
	if (theApp.value[3][0] == 1)
		m_ListShow2.AddString("码垛模块_OK1来料");
	if (theApp.value[3][1] == 1)
		m_ListShow2.AddString("码垛模块_OK2来料");
	if (theApp.value[3][2] == 1)
		m_ListShow2.AddString("码垛模块_OK1气缸伸出");
	if (theApp.value[3][3] == 1)
		m_ListShow2.AddString("码垛模块_OK1气缸缩回");
	if (theApp.value[3][4] == 1)
		m_ListShow2.AddString("码垛模块_OK2气缸伸出");
	if (theApp.value[3][5] == 1)
		m_ListShow2.AddString("码垛模块_OK2气缸缩回");
	if (theApp.value[3][6] == 1)
		m_ListShow2.AddString("码垛模块_推料气缸伸出");
	if (theApp.value[3][7] == 1)
		m_ListShow2.AddString("码垛模块_推料气缸缩回");
#pragma endregion 字节3

#pragma region 字节4
	if (theApp.value[4][0] == 1)
		m_ListShow2.AddString("复位按钮指示灯");
	if (theApp.value[4][1] == 1)
		m_ListShow2.AddString("运行按钮指示灯");
	if (theApp.value[4][2] == 1)
		m_ListShow2.AddString("暂停按钮指示灯");
	if (theApp.value[4][3] == 1)
		m_ListShow2.AddString("检测模块_警示灯_红灯");
	if (theApp.value[4][4] == 1)
		m_ListShow2.AddString("检测模块_警示灯_黄灯");
	if (theApp.value[4][5] == 1)
		m_ListShow2.AddString("检测模块_警示灯_绿灯");
	if (theApp.value[4][6] == 1)
		m_ListShow2.AddString("检测模块_警示灯_蓝灯");
	if (theApp.value[4][7] == 1)
		m_ListShow2.AddString("检测模块_警示灯_蜂鸣");
#pragma endregion 字节4

#pragma region 字节5
	if (theApp.value[5][0] == 1)
		m_ListShow2.AddString("检测模块-传送带1-运行");
	if (theApp.value[5][1] == 1)
		m_ListShow2.AddString("检测模块-传送带2-运行");
	if (theApp.value[15][2] == 1)
		m_ListShow2.AddString("检测模块_传送带3运行");
	if (theApp.value[5][3] == 1)
		m_ListShow2.AddString("检测模块_真空泵运行");
	if (theApp.value[5][4] == 1)
		m_ListShow2.AddString("检测模块_吸尘器运行");
	if (theApp.value[5][5] == 1)
		m_ListShow2.AddString("拆垛模块_伺服1报警清零");
	if (theApp.value[5][6] == 1)
		m_ListShow2.AddString("拆垛模块_伺服2报警清零");
	if (theApp.value[5][7] == 1)
		m_ListShow2.AddString("拆垛模块_传送带运行");
#pragma endregion 字节5

#pragma region 字节6
	if (theApp.value[6][0] == 1)
		m_ListShow2.AddString("码垛模块_伺服NG报警清零");
	if (theApp.value[6][1] == 1)
		m_ListShow2.AddString("码垛模块_伺服OK1报警清零");
	if (theApp.value[6][2] == 1)
		m_ListShow2.AddString("码垛模块_伺服OK2报警清零");
	if (theApp.value[6][3] == 1)
		m_ListShow2.AddString("码垛模块_OK1气缸伸出");
	if (theApp.value[6][4] == 1)
		m_ListShow2.AddString("码垛模块_OK2气缸伸出");
	if (theApp.value[6][5] == 1)
		m_ListShow2.AddString("码垛模块_推料气缸伸出");
	if (theApp.value[6][6] == 1)
		m_ListShow2.AddString("码垛模块_传送带运行");
	/*if (theApp.value[6][7] == 1)
		m_ListShow2.AddString("检测模块-警示灯-蓝灯");*/
#pragma endregion 字节6

#pragma region 字节8
	if (theApp.value[8][0] == 1)
		m_ListShow2.AddString("手动");
	if (theApp.value[8][1] == 1)
		m_ListShow2.AddString("复位中");
	if (theApp.value[8][2] == 1)
	{
		m_ListShow2.AddString("复位完成");
	}

	if (theApp.value[8][3] == 1)
	{
		m_ListShow2.AddString("运行");
	}

	if (theApp.value[8][4] == 1)
	{
		m_ListShow2.AddString("暂停");
	}

	if (theApp.value[8][5] == 1)
		m_ListShow2.AddString("停止");
	if (theApp.value[8][6] == 1)
		m_ListShow2.AddString("急停");
	if (theApp.value[12][7] == 1)
		//	m_ListShow.AddString("码垛模块-切换气缸2-切换");
#pragma endregion 字节8


#pragma region 字节13
	//if (theApp.value[13][0] == 1)
	//	m_ListShow.AddString("码垛模块-吸盘-吸气");
	//if (theApp.value[13][1] == 1)
	//	m_ListShow.AddString("码垛模块-夹紧气缸-夹紧");
	//if (theApp.value[13][2] == 1)
	//	m_ListShow.AddString("码垛模块-旋转气缸-旋转");
	//if (theApp.value[13][3] == 1)
	//	m_ListShow.AddString("出料模块-传送带-运行");
	//if (theApp.value[13][4] == 1)
	//	m_ListShow.AddString("上料模块-传送带-运行");
	//if (theApp.value[13][5] == 1)
	//	m_ListShow.AddString("离线上料模块-气缸1-得电");
	//if (theApp.value[13][6] == 1)
	//	m_ListShow.AddString("离线上料模块-气缸2-得电");
	//if (theApp.value[13][7] == 1)
	//	m_ListShow.AddString("离线上料模块-气缸3-得电");
#pragma endregion 字节13

#pragma region 字节14
	//if (theApp.value[14][0] == 1)
	//	m_ListShow.AddString("离线上料模块-气缸4-得电");
	//if (theApp.value[14][1] == 1)
	//	m_ListShow.AddString("离线上料模块-气缸5-得电");
	//if (theApp.value[14][2]== 1)
	//	m_ListShow.AddString("离线上料模块-气阀-吹气");
#pragma endregion 字节14

//#pragma region 字节20
//	if (theApp.value[20][0] == 1)
//	{
//		m_ListShow.AddString("码垛模块-旋转气缸-旋转_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "码垛模块-旋转气缸-旋转_超时");
//	}
//
//	if (theApp.value[20][1] == 1)
//	{
//		m_ListShow.AddString("码垛模块-旋转气缸-复位_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "码垛模块-旋转气缸-复位_超时");
//	}
//
//	if (theApp.value[20][2] == 1)
//	{
//		m_ListShow.AddString("码垛模块-夹紧气缸-夹紧_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "码垛模块-夹紧气缸-夹紧_超时");
//	}
//
//	if (theApp.value[20][3] == 1)
//	{
//		m_ListShow.AddString("码垛模块-夹紧气缸-松开_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "码垛模块-夹紧气缸-松开_超时");
//	}
//
//	if (theApp.value[20][4] == 1)
//	{
//		m_ListShow.AddString("码垛模块-切换气缸1-切换_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "码垛模块-切换气缸1-切换_超时");
//	}
//
//	if (theApp.value[20][5] == 1)
//	{
//		m_ListShow.AddString("码垛模块-切换气缸1-复位_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "码垛模块-切换气缸1-复位_超时");
//	}
//
//	if (theApp.value[20][6] == 1)
//	{
//		m_ListShow.AddString("码垛模块-切换气缸2-切换_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "码垛模块-切换气缸2-切换_超时");
//	}
//
//	if (theApp.value[20][7] == 1)
//	{
//		m_ListShow.AddString("码垛模块-切换气缸2-复位_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "码垛模块-切换气缸2-复位_超时");
//	}
//
//#pragma endregion 字节20
//
//#pragma region 字节21
//	if (theApp.value[21][0] == 1)
//	{
//		m_ListShow.AddString("码垛模块-纸杯检测-吸盘吸紧_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "码垛模块-纸杯检测-吸盘吸紧_超时");
//	}
//
//	if (theApp.value[21][0] == 1)
//	{
//		m_ListShow.AddString("报警_码垛模块-纸杯检测-吸盘松开_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_码垛模块-纸杯检测-吸盘松开_超时");
//	}
//
//	if (theApp.value[21][0] == 1)
//	{
//		m_ListShow.AddString("报警_离线上料模块-气缸1-动作_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_离线上料模块-气缸1-动作_超时");
//	}
//
//	if (theApp.value[21][0] == 1)
//	{
//		m_ListShow.AddString("报警_离线上料模块-气缸1-复位_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_离线上料模块-气缸1-复位_超时");
//	}
//
//	if (theApp.value[21][0] == 1)
//	{
//		m_ListShow.AddString("报警_离线上料模块-气缸2-动作_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_离线上料模块-气缸2-动作_超时");
//	}
//
//	if (theApp.value[21][0] == 1)
//	{
//		m_ListShow.AddString("报警_离线上料模块-气缸2-复位_超时");
//		m_logAlarm.WriteLogWithName("mAlarmLog", "报警_离线上料模块-气缸2-复位_超时");
//	}
//
//	if (theApp.value[21][0] == 1)
//	{
//		m_ListShow.AddString("报警_离线上料模块-气缸3-动作_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_离线上料模块-气缸3-动作_超时");
//	}
//
//	if (theApp.value[21][0] == 1)
//	{
//		m_ListShow.AddString("报警_离线上料模块-气缸3-复位_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_离线上料模块-气缸3-复位_超时");
//	}
//
//#pragma endregion 字节21
//
//#pragma region 字节22
//	if (theApp.value[22][0] == 1)
//	{
//		m_ListShow.AddString("报警_离线上料模块-气缸4-动作_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_离线上料模块-气缸4-动作_超时");
//	}
//
//	if (theApp.value[22][1] == 1)
//	{
//		m_ListShow.AddString("报警_离线上料模块-气缸4-复位_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_离线上料模块-气缸4-复位_超时");
//	}
//
//	if (theApp.value[22][2] == 1)
//	{
//		m_ListShow.AddString("报警_离线上料模块-气缸5-动作_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_离线上料模块-气缸5-动作_超时");
//	}
//
//	if (theApp.value[22][3] == 1)
//	{
//		m_ListShow.AddString("报警_离线上料模块-气缸5-复位_超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_离线上料模块-气缸5-复位_超时");
//	}
//
//#pragma endregion 字节22
//
//#pragma region 字节23
//	if (theApp.value[23][0] == 1)
//	{
//		m_ListShow.AddString("报警_复位_视觉复位超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_复位_视觉复位超时");
//	}
//
//	if (theApp.value[23][1] == 1)
//	{
//		m_ListShow.AddString("报警_复位_码垛模块模组复位超时");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_复位_码垛模块模组复位超时");
//	}
//
//#pragma endregion 字节23
//
//#pragma region 字节24
//	if (theApp.value[24][0] == 1)
//	{
//		m_ListShow.AddString("报警_运行_检测模块_纸杯计数溢出");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_运行_检测模块_纸杯计数溢出");
//	}
//
//	if (theApp.value[24][1] == 1)
//	{
//		m_ListShow.AddString("报警_运行_检测模块_视觉1连续NG");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_运行_检测模块_视觉1连续NG");
//	}
//
//	if (theApp.value[24][2] == 1)
//	{
//		m_ListShow.AddString("报警_运行_检测模块_视觉2连续NG");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_运行_检测模块_视觉2连续NG");
//	}
//
//	if (theApp.value[24][3] == 1)
//	{
//		m_ListShow.AddString("报警_运行_码垛模块_纸杯计数溢出");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_运行_码垛模块_纸杯计数溢出");
//	}
//
//#pragma endregion 字节24
//
//#pragma region 字节25
//	if (theApp.value[25][0] == 1)
//	{
//		m_ListShow.AddString("报警_码垛模块上模组轴报警");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_码垛模块上模组轴报警");
//	}
//
//	if (theApp.value[25][1] == 1)
//	{
//		m_ListShow.AddString("报警_码垛模块下模组轴报警");
//		m_logAlarm.WriteLogWithName("AlarmLog", "报警_码垛模块下模组轴报警");
//	}
//
//#pragma endregion 字节25
	//显示最后一行			
//int count1;
//count1 = m_ListShow2.GetCount();
m_ListShow2.SetTopIndex(m_ListShow2.GetCount() - 1);
}

//
//void CCDialogIO_OnLine::OnBnClickedButtonFan()
//{
//	// TODO:  在此添加控件通知处理程序代码
//	CWnd *pwnd = FindWindow(NULL,"IO通讯" ); //希望找到资源管理器
//	HWND hwnd3 = pwnd->GetSafeHwnd();
//	HWND hwnd4 = pwnd->m_hWnd; //得到它的HWND
//
//	HWND hwnd = AfxGetMainWnd()->GetSafeHwnd(); //得到它的HWND
//	HWND hwnd2=this->m_hWnd;
//	WSAAsyncSelect(theApp.m_sock_server, hwnd2, WM_SOCKET2, FD_READ | FD_ACCEPT | FD_WRITE);
//}


void CCDialogIO_OnLine::OnClose()
{
	// TODO:  在此添加消息处理程序代码和/或调用默认值

	/*delete[]theApp.text;
	theApp.text = NULL;*/
	CDialogEx::OnClose();
}


BYTE CCDialogIO_OnLine::power(BYTE num1, BYTE num2)   //函数定义
{
	BYTE result = 1;
	int i;
	for (i = 0; i < num2; i++)
		result *= num1;	//累乘
	return result;


}

void CCDialogIO_OnLine::Refresh()
{
	BYTE* bytes = new BYTE[4];
	//memset(bytes, 0, sizeof(bytes));//20210713添加
	intToByte((theApp.temp[0][7] * power(2, 7) + theApp.temp[0][6] * power(2, 6) + theApp.temp[0][5] * power(2, 5) + theApp.temp[0][4] * power(2, 4) + theApp.temp[0][3] * power(2, 3) + theApp.temp[0][2] * power(2, 2) + theApp.temp[0][1] * power(2, 1) + theApp.temp[0][0]), bytes);
	theApp.text[0] = *bytes;
	intToByte((theApp.temp[1][7] * power(2, 7) + theApp.temp[1][6] * power(2, 6) + theApp.temp[1][5] * power(2, 5) + theApp.temp[1][4] * power(2, 4) + theApp.temp[1][3] * power(2, 3) + theApp.temp[1][2] * power(2, 2) + theApp.temp[1][1] * power(2, 1) + theApp.temp[1][0]), bytes);
	theApp.text[1] = *bytes;
	intToByte((theApp.temp[2][7] * power(2, 7) + theApp.temp[2][6] * power(2, 6) + theApp.temp[2][5] * power(2, 5) + theApp.temp[2][4] * power(2, 4) + theApp.temp[2][3] * power(2, 3) + theApp.temp[2][2] * power(2, 2) + theApp.temp[2][1] * power(2, 1) + theApp.temp[2][0]), bytes);
	theApp.text[2] = *bytes;

	intToByte(theApp.temp[3][6] * power(2, 6) + theApp.temp[3][5] * power(2, 5) + theApp.temp[3][4] * power(2, 4) + theApp.temp[3][3] * power(2, 3) + theApp.temp[3][2] * power(2, 2) + theApp.temp[3][1] * power(2, 1) + theApp.temp[3][0], bytes);
	theApp.text[3] = *bytes;

	intToByte(theApp.temp[4][4] * power(2, 4) + theApp.temp[4][3] * power(2, 3) + theApp.temp[4][2] * power(2, 2) + theApp.temp[4][1] * power(2, 1) + theApp.temp[4][0], bytes);
	theApp.text[4] = *bytes;

	intToByte(theApp.temp[5][0], bytes);
	theApp.text[5] = *bytes;
	/*intToByte((theApp.temp[5][6] * power(2, 6) + theApp.temp[5][5] * power(2, 5) + theApp.temp[5][4] * power(2, 4) + theApp.temp[5][3] * power(2, 3) + theApp.temp[5][2] * power(2, 2) + theApp.temp[5][1] * power(2, 1) + theApp.temp[5][0]), bytes);
	theApp.text[5] = *bytes;*/


	CString str, s1, s2;

	for (int k = 0; k < 99; k++)
	{
		BYTE bt = *(char*)(theApp.text + k);
		s1.Format("%d", bt);
		s2 += s1;
	}

	SetDlgItemText(IDC_DEC, s2);//IDC_EDIT_SHOW
	SetDlgItemText(IDC_EDIT_SHOW, s2);//IDC_EDIT_SHOW


	delete[]bytes;
	bytes = NULL;
}


//
//void floatToBytesLittle(float value, unsigned char* cSendBuff, int pos)
//{
//	unsigned short i = 0;
//	float floatVariable = value;
//	unsigned char* pdata = (unsigned char*)&floatVariable;
//	for (i = 0; i < 4; i++)
//	{
//		cSendBuff[i + pos] = *pdata++;//float转BYTE
//	}
//}




void CCDialogIO_OnLine::int2bytes(int i, byte* bytes, int pos)
{
	memset(bytes, 0, sizeof(byte) * 2);
	bytes[pos + 1] = (byte)((0xff00 & i) >> 8);
	bytes[pos + 0] = (byte)(0xff & i);

	/*memset(bytes, 0, sizeof(byte)* 4);
	bytes[pos + 3] = (byte)(0xff & i);
	bytes[pos + 2] = (byte)((0xff00 & i) >> 8);
	bytes[pos + 1] = (byte)((0xff0000 & i) >> 16);
	bytes[pos + 0] = (byte)((0xff000000 & i) >> 24);*/
}

void CCDialogIO_OnLine::int2bytesNormal(int i, byte* bytes, int pos)
{
	//byte[] bytes = new byte[4];
	memset(bytes, 0, sizeof(byte) * 4);
	bytes[pos + 0] = (byte)(0xff & i);
	bytes[pos + 1] = (byte)((0xff00 & i) >> 8);
	bytes[pos + 1] = (byte)((0xff0000 & i) >> 16);
	bytes[pos + 3] = (byte)((0xff000000 & i) >> 24);
}




void CCDialogIO_OnLine::OnBnClickedButtonDefault()
{
	CString str;

	//str.Format("%d", theApp.nBlowValue_WaitTime_DishArrive);
	//SetDlgItemText(IDC_EDIT_DishArrive_WaitTime, str);

	//str.Format("%d", theApp.nBlowValue_ContinueBlowTime);
	//SetDlgItemText(IDC_EDIT_Continue_Blow_time, str);

	//str.Format("%d", theApp.nUnpack_WaitTime_SuckerInhale);//IDC_EDIT_DUST_WAIT_TIME
	//SetDlgItemText(IDC_EDIT_WaitTime_Inhale, str);

	//str.Format("%d", theApp.nUnpack_ContinueTime_SuckerInhale);
	//SetDlgItemText(IDC_EDIT_ContinueTime_Inhale, str);

	//str.Format("%d", theApp.nUnpack_MotorSpeed);
	//SetDlgItemText(IDC_EDIT_Motor_Speed, str);

	//str.Format("%d", theApp.nPack_Number_SingleLine);
	//SetDlgItemText(IDC_EDIT_Num_SingleChannel, str);

	//str.Format("%d", theApp.nPack_1to2_WaitTime_BlowValue);
	//SetDlgItemText(IDC_EDIT_1to2_WaitTime, str);

	//str.Format("%d", theApp.nPack_1to2_ContinueTime_BlowValue);
	//SetDlgItemText(IDC_EDIT_1to2_ContinueTime, str);

	//str.Format("%d", theApp.nPack_2to4_1_WaitTime_BlowValue);
	//SetDlgItemText(IDC_IEDIT_2to4_1_WaitTime, str);

	//str.Format("%d", theApp.nPack_2to4_1_ContinueTime_BlowValue);
	//SetDlgItemText(IDC_EDIT_2to4_1_ContinueTime, str);

	//str.Format("%d", theApp.nPack_2to4_2_WaitTime_BlowValue);
	//SetDlgItemText(IDC_EDIT_2to4_2_WaitTime, str);

	//str.Format("%d", theApp.nPack_2to4_2_ContinueTime_BlowValue);
	//SetDlgItemText(IDC_EDIT_2to4_2_ContinueTime, str);

}

//保存参设
void CCDialogIO_OnLine::OnBnClickedButtonSaveParam()
{
	CFileFind finder;

	CDefectInspectionSystemDlg* pDia = CDefectInspectionSystemDlg::s_pDialog;
	BOOL bFind = finder.FindFile(theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	if (!bFind)
	{
		AfxMessageBox("这是IO通讯的对话框，没有找到配置文件System.ini");
		return;
	}
	// TODO:  在此添加额外的初始化
	CString tmpstr;
	//和PLC通讯数据

	//14-15检测模块_吹料阀_纸盘到位后等待时间
	GetDlgItemText(IDC_EDIT_DishArrive_WaitTime, tmpstr);
	theApp.nCONTINUE_NG_NUMBER = atoi(tmpstr);
	WritePrivateProfileString("PLC", "CONTINUE_NG_NUMBER", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	//16-17
	GetDlgItemText(IDC_EDIT_Continue_Blow_time, tmpstr);
	theApp.nBlock_Time = atoi(tmpstr);
	WritePrivateProfileString("PLC", "Block_Time", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	//18-19
	GetDlgItemText(IDC_EDIT_WaitTime_Inhale, tmpstr);
	theApp.nSensor_Miss_Trigger_Time = atoi(tmpstr);
	WritePrivateProfileString("PLC", "Sensor_Miss_Trigger_Time", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	//20-21
	GetDlgItemText(IDC_EDIT_ContinueTime_Inhale, tmpstr);
	theApp.nVision1_FeedBack_Time = atoi(tmpstr);
	WritePrivateProfileString("PLC", "Vision1_FeedBack_Time", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	//22-23
	GetDlgItemText(IDC_EDIT_Motor_Speed, tmpstr);
	theApp.nVision2_FeedBack_Time = atoi(tmpstr);
	WritePrivateProfileString("PLC", "Vision2_FeedBack_Time", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");

	//24-25
	GetDlgItemText(IDC_EDIT_Num_SingleChannel, tmpstr);
	theApp.Unpack_Block_Time = atoi(tmpstr);
	WritePrivateProfileString("PLC", "Unpack_Block_Time", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	//26-27
	GetDlgItemText(IDC_EDIT_1to2_WaitTime, tmpstr);
	theApp.Length_Product = atof(tmpstr);
	WritePrivateProfileString("PLC", "Length_Product", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	//28-29
	GetDlgItemText(IDC_EDIT_1to2_ContinueTime, tmpstr);
	theApp.Rate_Product = atof(tmpstr);
	WritePrivateProfileString("PLC", "Rate_Product", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	//30-31
	GetDlgItemText(IDC_IEDIT_2to4_1_WaitTime, tmpstr);
	theApp.Space_Product = atof(tmpstr);
	WritePrivateProfileString("PLC", "Space_Product", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	//32-33
	GetDlgItemText(IDC_EDIT_2to4_1_ContinueTime, tmpstr);
	theApp.Pack_Sucker1_Inhale = atof(tmpstr);
	WritePrivateProfileString("PLC", "Pack_Sucker1_Inhale", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	//36-37
	GetDlgItemText(IDC_EDIT_OK1_Delay_time, tmpstr);
	theApp.Pack_Sucker2_Inhale = atof(tmpstr);
	WritePrivateProfileString("PLC", "Pack_Sucker2_Inhale", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	//40-41
	GetDlgItemText(IDC_EDIT16, tmpstr);//IDC_EDIT_OK2_Delay_time
	theApp.Pack_Sucker2_Inhale_Wait = atof(tmpstr);
	WritePrivateProfileString("PLC", "Pack_Sucker2_Inhale_Wait", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	//44-45
	GetDlgItemText(IDC_EDIT_Block_Time, tmpstr);
	theApp.Number_Single_Line = atoi(tmpstr);
	WritePrivateProfileString("PLC", "Number_Single_Line", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");


	GetDlgItemText(IDC_PackOK_DelayBlowTime, tmpstr);
	theApp.PackOK_DelayBlowTime = atoi(tmpstr);
	WritePrivateProfileString("PLC", "PackOK_DelayBlowTime", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");

	GetDlgItemText(IDC_EDIT_PACKOK_blowTime, tmpstr);
	theApp.PackOK_BlowTime = atoi(tmpstr);
	WritePrivateProfileString("PLC", "PackOK_BlowTime", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	//52-53
	GetDlgItemText(IDC_Row, tmpstr);
	theApp.Row = atoi(tmpstr);
	WritePrivateProfileString("PLC", "Row", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	//54-55
	GetDlgItemText(IDC_OKPush_DelayTime, tmpstr);
	theApp.OKPush_DelayTime = atoi(tmpstr);
	WritePrivateProfileString("PLC", "OKPush_DelayTime", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");

	GetDlgItemText(IDC_PackInhale_DelayTime, tmpstr);
	theApp.PackInhale_DelayTime = atoi(tmpstr);
	WritePrivateProfileString("PLC", "PackInhale_DelayTime", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");

	GetDlgItemText(IDC_PackInhale_ContinueTime2, tmpstr);
	theApp.PackInhale_ContinueTime = atoi(tmpstr);
	WritePrivateProfileString("PLC", "PackInhale_ContinueTime", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");

	GetDlgItemText(IDC_PackPush_DelayTime, tmpstr);
	theApp.PackPush_DelayTime = atoi(tmpstr);
	WritePrivateProfileString("PLC", "PackPush_DelayTime", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");

	GetDlgItemText(IDC_PackPush_CylinderSpreadTime, tmpstr);
	theApp.PackPush_CylinderSpreadTime = atoi(tmpstr);
	WritePrivateProfileString("PLC", "PackPush_CylinderSpreadTime", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");

	GetDlgItemText(IDC_spare1, tmpstr);
	theApp.spare1 = atoi(tmpstr);
	WritePrivateProfileString("PLC", "spare1", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	GetDlgItemText(IDC_spare2, tmpstr);
	theApp.spare2 = atoi(tmpstr);
	WritePrivateProfileString("PLC", "spare2", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");

	GetDlgItemText(IDC_new_spare1, tmpstr);
	theApp.new_spare1 = atoi(tmpstr);
	WritePrivateProfileString("PLC", "new_spare1", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	GetDlgItemText(IDC_new_spare2, tmpstr);
	theApp.new_spare2 = atoi(tmpstr);
	WritePrivateProfileString("PLC", "new_spare2", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	GetDlgItemText(IDC_new_spare3, tmpstr);
	theApp.new_spare3 = atoi(tmpstr);
	WritePrivateProfileString("PLC", "new_spare3", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	GetDlgItemText(IDC_new_spare4, tmpstr);
	theApp.new_spare4 = atoi(tmpstr);
	WritePrivateProfileString("PLC", "new_spare4", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	GetDlgItemText(IDC_new_spare5, tmpstr);
	theApp.new_spare5 = atof(tmpstr);//
	WritePrivateProfileString("PLC", "new_spare5", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	GetDlgItemText(IDC_new_spare6, tmpstr);
	theApp.new_spare6 = atoi(tmpstr);
	WritePrivateProfileString("PLC", "new_spare6", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");

	GetDlgItemText(IDC_spare11, tmpstr);
	theApp.new_spare11 = atoi(tmpstr);
	WritePrivateProfileString("PLC", "new_spare11", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	GetDlgItemText(IDC_spare22, tmpstr);
	theApp.new_spare22 = atof(tmpstr);//
	WritePrivateProfileString("PLC", "new_spare22", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	GetDlgItemText(IDC_spare33, tmpstr);
	theApp.new_spare33 = atoi(tmpstr);
	WritePrivateProfileString("PLC", "new_spare33", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	GetDlgItemText(IDC_spare44, tmpstr);
	theApp.new_spare44 = atoi(tmpstr);
	WritePrivateProfileString("PLC", "new_spare44", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	GetDlgItemText(IDC_spare55, tmpstr);
	theApp.new_spare55 = atoi(tmpstr);
	WritePrivateProfileString("PLC", "new_spare55", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	GetDlgItemText(IDC_spare66, tmpstr);
	theApp.new_spare66 = atoi(tmpstr);
	WritePrivateProfileString("PLC", "new_spare66", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	GetDlgItemText(IDC_spare77, tmpstr);
	theApp.new_spare77 = atoi(tmpstr);
	WritePrivateProfileString("PLC", "new_spare77", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	GetDlgItemText(IDC_spare88, tmpstr);
	theApp.new_spare88 = atoi(tmpstr);
	WritePrivateProfileString("PLC", "new_spare88", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
	GetDlgItemText(IDC_spare99, tmpstr);
	theApp.new_spare99 = atoi(tmpstr);
	WritePrivateProfileString("PLC", "new_spare99", tmpstr, theApp.m_strFilePath + "\\System-" + pDia->m_strCurrentCupType + ".ini");
}


//发送数据
void CCDialogIO_OnLine::OnBnClickedButtonSend()
{
	send(theApp.m_sock_client, (const char*)theApp.text, 99, 0);

	Sleep(100);

	send(theApp.m_sock_client, (const char*)theApp.text, 99, 0);


}

//接收参数
void CCDialogIO_OnLine::OnTimer(UINT_PTR nIDEvent)
{
	if (nIDEvent == 5)
	{
		char buffer[102400] = { 0 };
		//CDefectInspectionSystemDlg *pDia = CDefectInspectionSystemDlg::s_pDialog;
		int num = sizeof(theApp.bufferToIo);
		/*CString str;
		str.Format("\n-----------%d", num);
		OutputDebugString(str);*/
		memcpy(&buffer, theApp.bufferToIo, num);
		if (num > 0)
		{
			try
			{
				//buffer[num] = 0;
				CString str;
				/*int num_OK1 = bytesToInt3((unsigned char*)buffer, 11);
				str.Format("\r\n%d", num_OK1);
				OutputDebugString( str);*/
				SetDlgItemInt(IDC_EDIT_SHOW2, bytesToInt3((unsigned char*)buffer, 12));
				/*int num_OK2 = bytesToInt3((unsigned char*)buffer, 15);
				str.Format("\r\n%d", num_OK2);
				OutputDebugString(str);*/
				SetDlgItemInt(IDC_EDIT_SHOW3, bytesToInt3((unsigned char*)buffer, 16));
				/*int num_OK3 = bytesToInt3((unsigned char*)buffer, 19);
				str.Format("\r\n%d", num_OK3);
				OutputDebugString(str);*/
				SetDlgItemInt(IDC_EDIT_SHOW4, bytesToInt3((unsigned char*)buffer, 20));
				SetDlgItemInt(IDC_EDIT_SHOW1, bytesToInt3((unsigned char*)buffer, 24));
				SetDlgItemInt(IDC_EDIT_SHOW6, bytesToInt3((unsigned char*)buffer, 28));
				SetDlgItemInt(IDC_EDIT_SHOW7, bytesToInt3((unsigned char*)buffer, 32));
				SetDlgItemInt(IDC_EDIT_SHOW8, bytesToInt3((unsigned char*)buffer, 36));

				speedMotor = bytesToInt3((unsigned char*)buffer, 40);
				str.Format("%d", speedMotor);
				SetDlgItemText(IDC_EDIT_SHOW5, str);

				speedUnpack = bytesToInt3((unsigned char*)buffer, 44);
				str.Format("%d", speedUnpack);
				SetDlgItemText(IDC_EDIT_SHOW10, str);

				spaceUnpack = bytesToInt3((unsigned char*)buffer, 48);
				str.Format("%d", spaceUnpack);
				SetDlgItemText(IDC_EDIT_SHOW11, str);

				SetDlgItemInt(IDC_EDIT_SHOW9, bytesToInt3((unsigned char*)buffer, 52));

				//SetDlgItemInt(IDC_EDIT_NUM_OK, bytesToInt4((unsigned char*)buffer, 56));

				//SetDlgItemInt(IDC_EDIT_NUM_NG2, bytesToInt4((unsigned char*)buffer, 60));

				//郭烽
				SetDlgItemInt(IDC_EDIT_SHOW13, bytesToInt3((unsigned char*)buffer, 56));
				SetDlgItemInt(IDC_EDIT_SHOW14, bytesToInt3((unsigned char*)buffer, 60));
				SetDlgItemInt(IDC_EDIT_SHOW15, bytesToInt3((unsigned char*)buffer, 64));
				SetDlgItemInt(IDC_EDIT_SHOW16, bytesToInt3((unsigned char*)buffer, 68));
				SetDlgItemInt(IDC_EDIT_SHOW17, bytesToInt3((unsigned char*)buffer, 72));
				SetDlgItemInt(IDC_EDIT_SHOW18, bytesToInt3((unsigned char*)buffer, 76));
				SetDlgItemInt(IDC_EDIT_SHOW19, bytesToInt3((unsigned char*)buffer, 80));
				SetDlgItemInt(IDC_EDIT_SHOW20, bytesToInt3((unsigned char*)buffer, 84));
				SetDlgItemInt(IDC_EDIT_SHOW21, bytesToInt3((unsigned char*)buffer, 88));
				SetDlgItemInt(IDC_EDIT_SHOW22, bytesToInt3((unsigned char*)buffer, 92));
				SetDlgItemInt(IDC_EDIT_SHOW23, bytesToInt3((unsigned char*)buffer, 96));

				SetDlgItemInt(IDC_STATIC1_OK, theApp.appVision1_OK);//发送信号数
				SetDlgItemInt(IDC_STATIC1_NG, theApp.appVision1_NG);
				SetDlgItemInt(IDC_STATIC22_OK, theApp.appVision2_OK);
				SetDlgItemInt(IDC_STATIC22_NG, theApp.appVision2_NG);
				SetDlgItemInt(IDC_STATIC_Back, theApp.appVisionBack);//相机采集数
				SetDlgItemInt(IDC_STATIC_Front, theApp.appVisionFront);

				/*SetDlgItemInt(IDC_STATIC_TG, theApp.appVisionTouGuang);
				SetDlgItemInt(IDC_STATIC_TG_OK, theApp.appVisionTG_OK);
				SetDlgItemInt(IDC_STATIC_TG_NG, theApp.appVisionTG_NG);*/
			}
			catch (...)
			{

			}
		}
	}

	// TODO:  在此添加消息处理程序代码和/或调用默认值
//	HINSTANCE  hinstance = (HINSTANCE)GetModuleHandle(NULL);
//	HBITMAP     gBmpLedGray;
//	HBITMAP     gBmpLedOff;
//	gBmpLedGray = LoadBitmap(hinstance, MAKEINTRESOURCE(IDB_BITMAP_GRAY));
//	gBmpLedOff = LoadBitmap(hinstance, MAKEINTRESOURCE(IDB_BITMAP_DFF));
//
//#pragma region 字节0
//	if (theApp.value[0][0] == 1)//000000000000000000000000000
//	{
//		m_ListShow2.AddString("DQ-拆垛模块伺服脉冲");
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_00);
//		gBmpLedStatic->SetBitmap(gBmpLedOff);
//	}
//	else
//	{
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_00);
//		gBmpLedStatic->SetBitmap(gBmpLedGray);
//	}
//
//	if (theApp.value[0][1] == 1)//1111111111111111111111111111111111111
//	{
//		m_ListShow2.AddString("DQ-拆垛模块伺服方向");
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_01);
//		gBmpLedStatic->SetBitmap(gBmpLedOff);
//	}
//	else
//	{
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_01);
//		gBmpLedStatic->SetBitmap(gBmpLedGray);
//	}
//
//	if (theApp.value[0][2] == 1)//22222222222222222222222222222222222
//	{
//		m_ListShow2.AddString("DQ-码垛模块-传送带运行");
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Conveyer_run);
//		gBmpLedStatic->SetBitmap(gBmpLedOff);
//	}
//	else
//	{
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Conveyer_run);
//		gBmpLedStatic->SetBitmap(gBmpLedGray);
//	}
//
//	if (theApp.value[0][3] == 1)//33333333333333333333333333
//	{
//		m_ListShow2.AddString("DQ-检测模块按钮指示灯-启动");
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Conveyer_run);
//		gBmpLedStatic->SetBitmap(gBmpLedOff);
//	}
//	else
//	{
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Conveyer_run);
//		gBmpLedStatic->SetBitmap(gBmpLedGray);
//	}
//
//	if (theApp.value[0][4] == 1)//44444444444444444444444444444
//	{
//		m_ListShow2.AddString("检测模块按钮指示灯-复位");
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Light_RUN);
//		gBmpLedStatic->SetBitmap(gBmpLedOff);
//	}
//	else
//	{
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Light_RUN);
//		gBmpLedStatic->SetBitmap(gBmpLedGray);
//	}
//
//
//	if (theApp.value[0][5] == 1)///55555555555555555555555
//	{
//		m_ListShow2.AddString("警示灯-红灯");
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Light_Red);
//		gBmpLedStatic->SetBitmap(gBmpLedOff);
//	}
//	else
//	{
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Light_Red);
//		gBmpLedStatic->SetBitmap(gBmpLedGray);
//	}
//
//	if (theApp.value[0][6] == 1)///////
//	{
//		m_ListShow2.AddString("警示灯-黄灯");//IDC_LIGHT_RESET
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Light_Yellow);
//		gBmpLedStatic->SetBitmap(gBmpLedOff);
//	}
//	else
//	{
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Light_Yellow);
//		gBmpLedStatic->SetBitmap(gBmpLedGray);
//	}
//
//	if (theApp.value[0][7] == 1)///////
//	{
//		m_ListShow2.AddString("警示灯-绿灯");//IDC_LIGHT_RESET
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Light_Green);
//		gBmpLedStatic->SetBitmap(gBmpLedOff);
//	}
//	else
//	{
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Light_Green);
//		gBmpLedStatic->SetBitmap(gBmpLedGray);
//	}
//
//#pragma endregion 字节0
//
//#pragma region 字节1
//		if (theApp.value[1][0] == 1)//000000000000000000000000000
//		{
//			m_ListShow2.AddString("警示灯-蓝灯");
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Light_Blue);
//			gBmpLedStatic->SetBitmap(gBmpLedOff);
//		}
//		else
//		{
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Light_Blue);
//			gBmpLedStatic->SetBitmap(gBmpLedGray);
//		}
//
//		if (theApp.value[1][1] == 1)//1111111111111111111
//		{
//			m_ListShow2.AddString("警示灯-蜂鸣");
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Buzz);
//			gBmpLedStatic->SetBitmap(gBmpLedOff);
//		}
//		else
//		{
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Buzz);
//			gBmpLedStatic->SetBitmap(gBmpLedGray);
//		}
//
//		if (theApp.value[1][2] == 1)//2222222222222222
//		{
//			m_ListShow2.AddString("检测模块-传送带1-运行");
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Conveyor1_run);
//			gBmpLedStatic->SetBitmap(gBmpLedOff);
//		}
//		else
//		{
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Conveyor1_run);
//			gBmpLedStatic->SetBitmap(gBmpLedGray);
//		}
//
//		if (theApp.value[1][3] == 1)//33333333333333333333
//		{
//			m_ListShow2.AddString("检测模块-传送带2-运行");
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Conveyor2_run);
//			gBmpLedStatic->SetBitmap(gBmpLedOff);
//		}
//		else
//		{
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Conveyor2_run);
//			gBmpLedStatic->SetBitmap(gBmpLedGray);
//		}
//
//		if (theApp.value[1][4] == 1)//444444444444444444444
//		{
//			m_ListShow2.AddString("检测模块-除尘阀");
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_BLOW_Dust);
//			gBmpLedStatic->SetBitmap(gBmpLedOff);
//		}
//		else
//		{
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_BLOW_Dust);
//			gBmpLedStatic->SetBitmap(gBmpLedGray);
//		}
//
//		if (theApp.value[1][5] == 1)//55555555555555555555555
//		{
//			m_ListShow2.AddString("检测模块-吹料阀");
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Blow_Stuff);
//			gBmpLedStatic->SetBitmap(gBmpLedOff);
//		}
//		else
//		{
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Blow_Stuff);
//			gBmpLedStatic->SetBitmap(gBmpLedGray);
//		}
//
//		if (theApp.value[1][6] == 1)//6666666666666666666
//		{
//			m_ListShow2.AddString("拆垛模块-伺服使能");
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_SF_On);
//			gBmpLedStatic->SetBitmap(gBmpLedOff);
//		}
//		else
//		{
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_SF_On);
//			gBmpLedStatic->SetBitmap(gBmpLedGray);
//		}
//
//		if (theApp.value[1][7] == 1)//777777777777777777
//		{
//			m_ListShow2.AddString("拆垛模块-伺服报警复位");
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_SF_Alarm_Reset);
//			gBmpLedStatic->SetBitmap(gBmpLedOff);
//		}
//		else
//		{
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_SF_Alarm_Reset);
//			gBmpLedStatic->SetBitmap(gBmpLedGray);
//		}
//
//#pragma endregion 字节1
//
//#pragma region 字节2
//		if (theApp.value[2][0] == 1)//000000000000000000000000000
//		{
//			m_ListShow2.AddString("拆垛模块-吸盘吸气");
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Unpack_Inhale);
//			gBmpLedStatic->SetBitmap(gBmpLedOff);
//		}
//		else
//		{
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Unpack_Inhale);
//			gBmpLedStatic->SetBitmap(gBmpLedGray);
//		}
//
//		if (theApp.value[2][1] == 1)//1111111111111111111
//		{
//			m_ListShow2.AddString("拆垛模块-气吹阀吹气");
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Unpack_Blow);
//			gBmpLedStatic->SetBitmap(gBmpLedOff);
//		}
//		else
//		{
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Unpack_Blow);
//			gBmpLedStatic->SetBitmap(gBmpLedGray);
//		}
//
//		if (theApp.value[2][2] == 1)//2222222222222222
//		{
//			m_ListShow2.AddString("码垛模块-1分2-气吹阀吹气");
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_1to2_Blow);
//			gBmpLedStatic->SetBitmap(gBmpLedOff);
//		}
//		else
//		{
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_1to2_Blow);
//			gBmpLedStatic->SetBitmap(gBmpLedGray);
//		}
//
//		if (theApp.value[2][3] == 1)//33333333333333333333
//		{
//			m_ListShow2.AddString("码垛模块-2分4_1-气吹阀吹气");
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_2to4_1_Blow);
//			gBmpLedStatic->SetBitmap(gBmpLedOff);
//		}
//		else
//		{
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_2to4_1_Blow);
//			gBmpLedStatic->SetBitmap(gBmpLedGray);
//		}
//
//		if (theApp.value[2][4] == 1)//444444444444444444444
//		{
//			m_ListShow2.AddString("垛模块-2分4_2-气吹阀吹气");
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_2to4_2_Blow);
//			gBmpLedStatic->SetBitmap(gBmpLedOff);
//		}
//		else
//		{
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_2to4_2_Blow);
//			gBmpLedStatic->SetBitmap(gBmpLedGray);
//		}
//
//#pragma endregion 字节2
//
//#pragma region 字节3
//	
//#pragma endregion 字节3
//
//#pragma region 字节4
//		if (theApp.value[4][0] == 1)//444444444444444444444
//		{
//			m_ListShow2.AddString("选择手动状态");
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Manual);
//			gBmpLedStatic->SetBitmap(gBmpLedOff);
//		}
//		else
//		{
//			CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Manual);
//			gBmpLedStatic->SetBitmap(gBmpLedGray);
//		}
//#pragma endregion 字节4
//
//#pragma region 字节5
//	if (theApp.value[5][0] == 1)
//	{
//		m_ListShow2.AddString("视觉通讯验证");
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Communicate);
//		gBmpLedStatic->SetBitmap(gBmpLedOff);
//	}
//	else
//	{
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Communicate);
//		gBmpLedStatic->SetBitmap(gBmpLedGray);
//	}
//		
//	if (theApp.value[5][1] == 1)
//	{
//		m_ListShow2.AddString("视觉检测1_OK");
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Vision1_OK);
//		gBmpLedStatic->SetBitmap(gBmpLedOff);
//	}
//	else
//	{
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Vision1_OK);
//		gBmpLedStatic->SetBitmap(gBmpLedGray);
//	}
//		
//	if (theApp.value[5][2] == 1)
//	{
//		m_ListShow2.AddString("视觉检测1_NG");
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Vision1_Ng);
//		gBmpLedStatic->SetBitmap(gBmpLedOff);
//	}
//	else
//	{
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Vision1_Ng);
//		gBmpLedStatic->SetBitmap(gBmpLedGray);
//	}
//		
//	if (theApp.value[5][3] == 1)
//	{
//		m_ListShow2.AddString("视觉检测2_OK");
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Vision2_OK);
//		gBmpLedStatic->SetBitmap(gBmpLedOff);
//	}
//	else
//	{
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_Vision2_OK);
//		gBmpLedStatic->SetBitmap(gBmpLedGray);
//	}
//		
//	if (theApp.value[5][4] == 1)
//	{
//		m_ListShow2.AddString("视觉检测2_NG");
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_VISION2_NG);
//		gBmpLedStatic->SetBitmap(gBmpLedOff);
//	}
//	else
//	{
//		CStatic*  gBmpLedStatic = (CStatic*)GetDlgItem(IDC_CHECK_VISION2_NG);
//		gBmpLedStatic->SetBitmap(gBmpLedGray);
//	}
//		
//#pragma endregion 字节5
//
//
//
//#pragma region 字节20
//	if (theApp.value[20][0] == 1)
//		m_ListShow2.AddString("码垛模块-旋转气缸-旋转_超时");
//	if (theApp.value[20][1] == 1)
//		m_ListShow2.AddString("码垛模块-旋转气缸-复位_超时");
//	if (theApp.value[20][2] == 1)
//		m_ListShow2.AddString("码垛模块-夹紧气缸-夹紧_超时");
//	if (theApp.value[20][3] == 1)
//		m_ListShow2.AddString("码垛模块-夹紧气缸-松开_超时");
//	if (theApp.value[20][4] == 1)
//		m_ListShow2.AddString("码垛模块-切换气缸1-切换_超时");
//	if (theApp.value[20][5] == 1)
//		m_ListShow2.AddString("码垛模块-切换气缸1-复位_超时");
//	if (theApp.value[20][6] == 1)
//		m_ListShow2.AddString("码垛模块-切换气缸2-切换_超时");
//	if (theApp.value[20][7] == 1)
//		m_ListShow2.AddString("码垛模块-切换气缸2-复位_超时");
//#pragma endregion 字节20
//
//#pragma region 字节21
//	if (theApp.value[21][0] == 1)
//		m_ListShow2.AddString("码垛模块-纸杯检测-吸盘吸紧_超时");
//	if (theApp.value[21][0] == 1)
//		m_ListShow2.AddString("报警_码垛模块-纸杯检测-吸盘松开_超时");
//	if (theApp.value[21][0] == 1)
//		m_ListShow2.AddString("报警_离线上料模块-气缸1-动作_超时");
//	if (theApp.value[21][0] == 1)
//		m_ListShow2.AddString("报警_离线上料模块-气缸1-复位_超时");
//	if (theApp.value[21][0] == 1)
//		m_ListShow2.AddString("报警_离线上料模块-气缸2-动作_超时");
//	if (theApp.value[21][0] == 1)
//		m_ListShow2.AddString("报警_离线上料模块-气缸2-复位_超时");
//	if (theApp.value[21][0] == 1)
//		m_ListShow2.AddString("报警_离线上料模块-气缸3-动作_超时");
//	if (theApp.value[21][0] == 1)
//		m_ListShow2.AddString("报警_离线上料模块-气缸3-复位_超时");
//#pragma endregion 字节21
//
//#pragma region 字节22
//	if (theApp.value[22][0] == 1)
//		m_ListShow2.AddString("报警_离线上料模块-气缸4-动作_超时");
//	if (theApp.value[22][1] == 1)
//		m_ListShow2.AddString("报警_离线上料模块-气缸4-复位_超时");
//	if (theApp.value[22][2] == 1)
//		m_ListShow2.AddString("报警_离线上料模块-气缸5-动作_超时");
//	if (theApp.value[22][3] == 1)
//		m_ListShow2.AddString("报警_离线上料模块-气缸5-复位_超时");
//#pragma endregion 字节22
//
//#pragma region 字节23
//	if (theApp.value[23][0] == 1)
//		m_ListShow2.AddString("报警_复位_视觉复位超时");
//	if (theApp.value[23][1] == 1)
//		m_ListShow2.AddString("报警_复位_码垛模块模组复位超时");
//#pragma endregion 字节23
//
//#pragma region 字节24
//	if (theApp.value[24][0] == 1)
//		m_ListShow2.AddString("报警_运行_检测模块_纸杯计数溢出");
//	if (theApp.value[24][1] == 1)
//		m_ListShow2.AddString("报警_运行_检测模块_视觉1连续NG");
//	if (theApp.value[24][2] == 1)
//		m_ListShow2.AddString("报警_运行_检测模块_视觉2连续NG");
//	if (theApp.value[24][3] == 1)
//		m_ListShow2.AddString("报警_运行_码垛模块_纸杯计数溢出");
//#pragma endregion 字节24
//
//#pragma region 字节25
//	if (theApp.value[25][0] == 1)
//		m_ListShow2.AddString("报警_码垛模块上模组轴报警");
//	if (theApp.value[25][1] == 1)
//		m_ListShow2.AddString("报警_码垛模块下模组轴报警");
//#pragma endregion 字节25

	CDialogEx::OnTimer(nIDEvent);
}


void CCDialogIO_OnLine::OnEnChangeEditDisharriveWaittime()
{
	CString str;
	GetDlgItemText(IDC_EDIT_DishArrive_WaitTime, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 14);
	Refresh();
}


//void CCDialogIO_OnLine::OnEnChangeEditContinuetimeBlow()
//{
//	CString str;
//	GetDlgItemText(IDC_EDIT_Continue_Blow_time, str);
//	int pos = atoi(str);
//	int2bytes(pos, theApp.text, 12);
//	Refresh();
//}

//16-19 拆垛模块_到原点后吸盘吸气等待时间
void CCDialogIO_OnLine::OnEnChangeEditWaittimeInhale()
{
	CString str;
	GetDlgItemText(IDC_EDIT_WaitTime_Inhale, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 18);
	Refresh();
}

//20-23 拆垛模块_到原点后吸盘吸气持续时间
void CCDialogIO_OnLine::OnEnChangeEditContinuetimeInhale()
{
	CString str;
	GetDlgItemText(IDC_EDIT_ContinueTime_Inhale, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 20);
	Refresh();
}



//24-27
void CCDialogIO_OnLine::OnEnChangeEditMotorSpeed()
{
	CString str;
	GetDlgItemText(IDC_EDIT_Motor_Speed, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 22);
	Refresh();
}



//28-31 码垛模块_单垛数量
void CCDialogIO_OnLine::OnEnChangeEditNumSinglechannel()
{
	CString str;
	GetDlgItemText(IDC_EDIT_Num_SingleChannel, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 24);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEdit1to2Waittime()
{
	CString str;
	GetDlgItemText(IDC_EDIT_1to2_WaitTime, str);
	int pos = (int)(atoi(str));// * 100
	int2bytes(pos, theApp.text, 26);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEdit1to2Continuetime()
{
	CString str;
	GetDlgItemText(IDC_EDIT_1to2_ContinueTime, str);
	int pos = atoi(str);
	//if (pos > 12000)
	//{
	//	pos = 9000;
	//	SetDlgItemInt(IDC_EDIT_1to2_ContinueTime, 90);
	//	AfxMessageBox("最大节拍不能超过120");
	//}

	int2bytes(pos, theApp.text, 28);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeIedit2to41Waittime()
{
	CString str;
	GetDlgItemText(IDC_IEDIT_2to4_1_WaitTime, str);
	int pos = (int)(atoi(str));
	int2bytes(pos, theApp.text, 30);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEdit2to41Continuetime()
{
	CString str;
	GetDlgItemText(IDC_EDIT_2to4_1_ContinueTime, str);
	int pos = (int)(atoi(str));
	int2bytes(pos, theApp.text, 32);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEdit2to42Waittime()
{

}


void CCDialogIO_OnLine::OnEnChangeEdit2to42Continuetime()
{

}


void CCDialogIO_OnLine::OnBnClickedCheck00()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_00);
	if (p->GetCheck() == 1)//选中
		theApp.temp[0][0] = 1;
	else
		theApp.temp[0][0] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheck01()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_01);
	if (p->GetCheck() == 1)//选中
		theApp.temp[0][1] = 1;
	else
		theApp.temp[0][1] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckConveyerrun()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Conveyer_run);
	if (p->GetCheck() == 1)//选中
		theApp.temp[0][2] = 1;
	else
		theApp.temp[0][2] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckLightRun()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Light_RUN);
	if (p->GetCheck() == 1)//选中
		theApp.temp[0][3] = 1;
	else
		theApp.temp[0][3] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckLightReset()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Light_Reset);
	if (p->GetCheck() == 1)//选中
		theApp.temp[0][4] = 1;
	else
		theApp.temp[0][4] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckLightRed()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Light_Red);
	if (p->GetCheck() == 1)//选中
		theApp.temp[0][5] = 1;
	else
		theApp.temp[0][5] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckLightYellow()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Light_Yellow);
	if (p->GetCheck() == 1)//选中
		theApp.temp[0][6] = 1;
	else
		theApp.temp[0][6] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckLightGreen()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Light_Green);
	if (p->GetCheck() == 1)//选中
		theApp.temp[0][7] = 1;
	else
		theApp.temp[0][7] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckLightBlue()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Light_Blue);
	if (p->GetCheck() == 1)//选中
		theApp.temp[1][0] = 1;
	else
		theApp.temp[1][0] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckBuzz()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Buzz);
	if (p->GetCheck() == 1)//选中
		theApp.temp[1][1] = 1;
	else
		theApp.temp[1][1] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckConveyor1run()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Conveyor1_run);
	if (p->GetCheck() == 1)//选中
		theApp.temp[1][2] = 1;
	else
		theApp.temp[1][2] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckConveyor2run()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Conveyor2_run);
	if (p->GetCheck() == 1)//选中
		theApp.temp[1][3] = 1;
	else
		theApp.temp[1][3] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckBlowDust()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_BLOW_Dust);
	if (p->GetCheck() == 1)//选中
		theApp.temp[1][4] = 1;
	else
		theApp.temp[1][4] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckBlowStuff()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Blow_Stuff);
	if (p->GetCheck() == 1)//选中
		theApp.temp[1][5] = 1;
	else
		theApp.temp[1][5] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckSfOn()
{
	// TODO:  在此添加控件通知处理程序代码  
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_SF_On);
	if (p->GetCheck() == 1)//选中
		theApp.temp[1][6] = 1;
	else
		theApp.temp[1][6] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckSfAlarmReset()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_SF_Alarm_Reset);
	if (p->GetCheck() == 1)//选中
		theApp.temp[1][7] = 1;
	else
		theApp.temp[1][7] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckUnpackInhale()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Unpack_Inhale);
	if (p->GetCheck() == 1)//选中
		theApp.temp[2][0] = 1;
	else
		theApp.temp[2][0] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckUnpackBlow()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Unpack_Blow);
	if (p->GetCheck() == 1)//选中
		theApp.temp[2][1] = 1;
	else
		theApp.temp[2][1] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheck1to2Blow()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_1to2_Blow);
	if (p->GetCheck() == 1)//选中
		theApp.temp[2][2] = 1;
	else
		theApp.temp[2][2] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheck2to41Blow()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_2to4_1_Blow);
	if (p->GetCheck() == 1)//选中
		theApp.temp[2][3] = 1;
	else
		theApp.temp[2][3] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheck2to42Blow()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_2to4_2_Blow);
	if (p->GetCheck() == 1)//选中
		theApp.temp[2][4] = 1;
	else
		theApp.temp[2][4] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckManual()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Manual);
	if (p->GetCheck() == 1)//选中
		theApp.temp[4][0] = 1;
	else
		theApp.temp[4][0] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckCommunicate()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Communicate);
	if (p->GetCheck() == 1)//选中
		theApp.temp[5][0] = 1;
	else
		theApp.temp[5][0] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckVision1Ok()
{
	// TODO:  在此添加控件通知处理程序代码  
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Vision1_OK);
	if (p->GetCheck() == 1)//选中
		theApp.temp[5][1] = 1;
	else
		theApp.temp[5][1] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckVision1Ng()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Vision1_Ng);
	if (p->GetCheck() == 1)//选中
		theApp.temp[5][2] = 1;
	else
		theApp.temp[5][2] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckVision2Ok()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Vision2_OK);
	if (p->GetCheck() == 1)//选中
		theApp.temp[5][3] = 1;
	else
		theApp.temp[5][3] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckVision2Ng()
{
	// TODO:  在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_VISION2_NG);
	if (p->GetCheck() == 1)//选中
		theApp.temp[5][4] = 1;
	else
		theApp.temp[5][4] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEditContinuengnum()
{
	// TODO:  如果该控件是 RICHEDIT 控件，它将不
	// 发送此通知，除非重写 CDialogEx::OnInitDialog()
	// 函数并调用 CRichEditCtrl().SetEventMask()，
	// 同时将 ENM_CHANGE 标志“或”运算到掩码中。

	// TODO:  在此添加控件通知处理程序代码
	CString str;
	GetDlgItemText(IDC_EDIT_ContinueNGNUM, str);
	int pos = atoi(str);
	theApp.text[7] = pos;
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEditUnpackInhalerate()
{
	// TODO:  如果该控件是 RICHEDIT 控件，它将不
	// 发送此通知，除非重写 CDialogEx::OnInitDialog()
	// 函数并调用 CRichEditCtrl().SetEventMask()，
	// 同时将 ENM_CHANGE 标志“或”运算到掩码中。

	CString str;
	GetDlgItemText(IDC_EDIT_Unpack_InhaleRate, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 52);
	Refresh();
	// TODO:  在此添加控件通知处理程序代码
}


void CCDialogIO_OnLine::OnEnChangeEditContinueBlowtime()
{
	CString str;
	GetDlgItemText(IDC_EDIT_Continue_Blow_time, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 16);
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckRun()
{
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Run);
	if (p->GetCheck() == 1)//选中
		theApp.temp[2][5] = 1;
	else
		theApp.temp[2][5] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckClearBlock()
{
	// TODO:  在此添加控件通知处理程序代码  IDC_CHECK_Clear_Block
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Clear_Block);
	if (p->GetCheck() == 1)//选中
		theApp.temp[2][6] = 1;
	else
		theApp.temp[2][6] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEditUnpackInhalerate1()
{
	CString str;
	GetDlgItemText(IDC_EDIT_Unpack_InhaleRate1, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 52);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEditUnpackInhalerate2()
{
	CString str;
	GetDlgItemText(IDC_EDIT_Unpack_InhaleRate2, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 60);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEditUnpackInhalerate3()
{
	CString str;
	GetDlgItemText(IDC_EDIT_Unpack_InhaleRate3, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 64);
	Refresh();
}



void CCDialogIO_OnLine::OnEnChangeEditOk1Delaytime()
{
	CString str;
	GetDlgItemText(IDC_EDIT_OK1_Delay_time, str);
	int pos = (int)(atoi(str));
	int2bytes(pos, theApp.text, 36);
	Refresh();
}


//void CCDialogIO_OnLine::OnEnChangeEditOk2Delaytime()//--------------------------------------
//{
//	CString str;
//	GetDlgItemText(IDC_EDIT_OK2_Delay_time, str);
//	int pos = (int)(atof(str) * 100);
//	int2bytes(pos, theApp.text, 52);
//	Refresh();
//}


void CCDialogIO_OnLine::OnEnChangeEditBlockTime()
{
	CString str;
	GetDlgItemText(IDC_EDIT_Block_Time, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 44);
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckOk()
{
	// TODO: 在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_OK);
	theApp.temp[4][1] = 0;
	theApp.temp[4][2] = 0;
	if (p->GetCheck() == 1)//选中
		theApp.temp[4][1] = 1;
	else
		theApp.temp[4][1] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckNg()
{
	// TODO: 在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_NG);
	theApp.temp[4][1] = 0;
	theApp.temp[4][2] = 0;
	if (p->GetCheck() == 1)//选中
		theApp.temp[4][2] = 1;
	else
		theApp.temp[4][2] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckManual2()
{
	// TODO: 在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Manual2);
	if (p->GetCheck() == 1)//选中
		theApp.temp[3][0] = 1;
	else
		theApp.temp[3][0] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckOk2()
{
	// TODO: 在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_OK2);
	if (p->GetCheck() == 1)//选中
		theApp.temp[3][1] = 1;
	else
		theApp.temp[3][1] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckClearBlock2()
{
	// TODO: 在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_Clear_Block2);
	if (p->GetCheck() == 1)//选中
		theApp.temp[2][7] = 1;
	else
		theApp.temp[2][7] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckOk3()
{
	// TODO: 在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_OK3);
	if (p->GetCheck() == 1)//选中
		theApp.temp[3][2] = 1;
	else
		theApp.temp[3][2] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckOk4()
{
	// TODO: 在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_OK4);
	if (p->GetCheck() == 1)//选中
		theApp.temp[3][3] = 1;
	else
		theApp.temp[3][3] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheckOk5()
{
	// TODO: 在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_OK5);
	/*theApp.temp[4][1] = 0;
	theApp.temp[4][2] = 0;*/
	if (p->GetCheck() == 1)//选中
		theApp.temp[4][3] = 1;
	else
		theApp.temp[4][3] = 0;
	Refresh();//---------
}


void CCDialogIO_OnLine::OnBnClickedCheckNg2()
{
	// TODO: 在此添加控件通知处理程序代码
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK_NG2);
	if (p->GetCheck() == 1)//选中
		theApp.temp[4][4] = 1;
	else
		theApp.temp[4][4] = 0;
	Refresh();
}





void CCDialogIO_OnLine::OnEnChangeEdit2()
{
	CString str;
	GetDlgItemText(IDC_EDIT2, str);
	int pos = (int)(atof(str) * 100);
	int2bytes(pos, theApp.text, 64);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEdit3()
{
	CString str;
	GetDlgItemText(IDC_EDIT3, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 68);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEdit4()
{
	CString str;
	GetDlgItemText(IDC_EDIT4, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 72);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEdit10()
{
	CString str;
	GetDlgItemText(IDC_EDIT10, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 76);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEdit11()
{
	CString str;
	GetDlgItemText(IDC_EDIT11, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 80);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEdit12()
{
	CString str;
	GetDlgItemText(IDC_EDIT12, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 84);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEdit5()
{
	CString str;
	GetDlgItemText(IDC_EDIT5, str);
	int pos = (int)(atof(str) * 100);
	int2bytes(pos, theApp.text, 88);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEdit14()
{
	CString str;
	GetDlgItemText(IDC_EDIT14, str);
	int pos = (int)(atof(str) * 100);
	int2bytes(pos, theApp.text, 92);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEdit15()
{
	CString str;
	GetDlgItemText(IDC_EDIT15, str);
	int pos = (int)(atof(str) * 100);
	int2bytes(pos, theApp.text, 96);
	Refresh();
}




void CCDialogIO_OnLine::OnEnChangeEdit567()
{
	CString str;
	//OutputDebugString("\r\njinlaile");
	GetDlgItemText(IDC_EDIT_567, str);
	int pos = (int)(atof(str) * 100);
	int2bytes(pos, theApp.text, 52);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeEdit16()
{
	// TODO:  如果该控件是 RICHEDIT 控件，它将不
	// 发送此通知，除非重写 CDialogEx::OnInitDialog()
	// 函数并调用 CRichEditCtrl().SetEventMask()，
	// 同时将 ENM_CHANGE 标志“或”运算到掩码中。

	// TODO:  在此添加控件通知处理程序代码

	CString str;
	//OutputDebugString("\r\njinlaile");
	GetDlgItemText(IDC_EDIT16, str);
	int pos = (int)(atoi(str));
	int2bytes(pos, theApp.text, 40);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangePackokDelayblowtime()
{
	CString str;
	GetDlgItemText(IDC_PackOK_DelayBlowTime, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 48);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangePackokBlowtime()
{
	/*CString str;
	GetDlgItemText(IDC_PackOK_BlowTime, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 50);
	Refresh();*/
}


void CCDialogIO_OnLine::OnEnChangeEditPackokblowtime()
{
	// TODO:  如果该控件是 RICHEDIT 控件，它将不
	// 发送此通知，除非重写 CDialogEx::OnInitDialog()
	// 函数并调用 CRichEditCtrl().SetEventMask()，
	// 同时将 ENM_CHANGE 标志“或”运算到掩码中。

	// TODO:  在此添加控件通知处理程序代码  IDC_EDIT_PACKOK_blowTime
	CString str;
	GetDlgItemText(IDC_EDIT_PACKOK_blowTime, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 50);
	Refresh();

}


void CCDialogIO_OnLine::OnEnChangeRow()
{
	CString str;
	GetDlgItemText(IDC_Row, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 52);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangeOkpushDelaytime()
{
	// TODO:  如果该控件是 RICHEDIT 控件，它将不
	// 发送此通知，除非重写 CDialogEx::OnInitDialog()
	// 函数并调用 CRichEditCtrl().SetEventMask()，
	// 同时将 ENM_CHANGE 标志“或”运算到掩码中。

	// TODO:  在此添加控件通知处理程序代码 IDC_OKPush_DelayTime
	CString str;
	GetDlgItemText(IDC_OKPush_DelayTime, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 54);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangePackinhaleDelaytime()
{
	CString str;
	GetDlgItemText(IDC_PackInhale_DelayTime, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 56);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangePackinhaleContinuetime()
{
	CString str;
	GetDlgItemText(IDC_PackInhale_ContinueTime, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 58);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangePackpushDelaytime()
{
	CString str;
	GetDlgItemText(IDC_PackPush_DelayTime, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 60);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangePackpushCylinderspreadtime()
{
	CString str;
	GetDlgItemText(IDC_PackPush_CylinderSpreadTime, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 62);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangespare1()
{
	CString str;
	GetDlgItemText(IDC_spare1, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 64);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangespare2()
{
	CString str;
	GetDlgItemText(IDC_spare2, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 66);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangePackinhaleContinuetime2()
{
	CString str;
	GetDlgItemText(IDC_PackInhale_ContinueTime2, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 58);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangenewspare1()
{
	CString str;
	GetDlgItemText(IDC_new_spare1, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 68);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangenewspare2()
{
	CString str;
	GetDlgItemText(IDC_new_spare2, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 70);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangenewspare3()
{
	CString str;
	GetDlgItemText(IDC_new_spare3, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 72);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangenewspare4()
{
	CString str;
	GetDlgItemText(IDC_new_spare4, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 74);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangenewspare5()
{
	CString str;
	GetDlgItemText(IDC_new_spare5, str);
	int pos = (int)(atof(str) * 10);//
	int2bytes(pos, theApp.text, 76);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangenewspare6()
{
	CString str;
	GetDlgItemText(IDC_new_spare6, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 78);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangespare11()
{
	CString str;
	GetDlgItemText(IDC_spare11, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 80);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangespare22()
{
	CString str;
	GetDlgItemText(IDC_spare22, str);
	int pos = (int)(atof(str) * 10);//
	int2bytes(pos, theApp.text, 82);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangespare33()
{
	CString str;
	GetDlgItemText(IDC_spare33, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 84);
	Refresh();
}


//void CCDialogIO_OnLine::OnEnChangespare44()
//{
//	CString str;
//	GetDlgItemText(IDC_spare44, str);
//	int pos = atoi(str);
//	int2bytes(pos, theApp.text, 86);
//	Refresh();
//}

void CCDialogIO_OnLine::OnEnChangespare44()
{
	CString str;
	GetDlgItemText(IDC_spare44, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 86);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangespare55()
{
	CString str;
	GetDlgItemText(IDC_spare55, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 88);
	Refresh();
}


void CCDialogIO_OnLine::OnEnChangespare66()
{
	CString str;
	GetDlgItemText(IDC_spare66, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 90);
	Refresh();
}

void CCDialogIO_OnLine::OnEnChangespare77()
{
	CString str;
	GetDlgItemText(IDC_spare77, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 92);
	Refresh();
}

void CCDialogIO_OnLine::OnEnChangespare88()
{
	CString str;
	GetDlgItemText(IDC_spare88, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 94);
	Refresh();
}

void CCDialogIO_OnLine::OnEnChangespare99()
{
	CString str;
	GetDlgItemText(IDC_spare99, str);
	int pos = atoi(str);
	int2bytes(pos, theApp.text, 96);
	Refresh();
}

void CCDialogIO_OnLine::OnRButtonDblClk(UINT nFlags, CPoint point)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	//UpdateUI(false);
	CDialogEx::OnRButtonDblClk(nFlags, point);
}

//int idsUser[] = { IDC_CHECK_Light_Blue,IDC_CHECK_Blow_Stuff ,    IDC_CHECK_1to2_Blow ,IDC_CHECK_2to4_1_Blow ,IDC_CHECK_2to4_2_Blow ,IDC_CHECK_Run,     IDC_CHECK_Manual2,IDC_CHECK_Manual,IDC_CHECK_OK,IDC_CHECK_NG };
//int ids[] = { IDC_CHECK_00 ,IDC_CHECK_01 ,IDC_CHECK_Conveyer_run ,IDC_CHECK_Light_RUN ,IDC_CHECK_Light_Reset,IDC_CHECK_Light_Red,IDC_CHECK_Light_Yellow,IDC_CHECK_Light_Green,
//			IDC_CHECK_Buzz ,IDC_CHECK_Conveyor1_run ,IDC_CHECK_Conveyor2_run ,IDC_CHECK_BLOW_Dust ,IDC_CHECK_SF_On ,IDC_CHECK_SF_Alarm_Reset ,
//			IDC_CHECK_Unpack_Inhale ,IDC_CHECK_Unpack_Blow ,IDC_CHECK_OK2,IDC_CHECK_OK3,IDC_CHECK_OK4,//IDC_CHECK_Clear_Block ,IDC_CHECK_Clear_Block2,
//			IDC_CHECK_OK5,IDC_CHECK_NG2,IDC_CHECK_Communicate ,IDC_STATIC1,IDC_STATIC2,IDC_STATIC3,IDC_STATIC4,IDC_STATIC5,IDC_STATIC6,IDC_STATIC7,IDC_CHECK1,IDC_CHECK2 };
//
//int idsStaticUser[] = { IDC_STATIC32_33,IDC_STATIC52_53 ,IDC_STATIC80_81 ,IDC_STATIC82_83 ,IDC_STATIC84_85 ,IDC_STATIC86_87 ,IDC_STATIC88_89 ,IDC_STATIC90_91 };
//int idsStatic[] = { IDC_STATIC14_15,IDC_STATIC16_17,IDC_STATIC18_19,IDC_STATIC20_21 ,IDC_STATIC22_23 ,IDC_STATIC24_25 ,IDC_STATIC26_27 ,IDC_STATIC28_29 ,IDC_STATIC30_31,IDC_STATIC36_37,IDC_STATIC40_41
//				,IDC_STATIC44_45 ,IDC_STATIC48_49 ,IDC_STATIC50_51,IDC_STATIC54_55,IDC_STATIC56_57,IDC_STATIC58_59,IDC_STATIC60_61,IDC_STATIC62_63,IDC_STATIC64_65,IDC_STATIC66_67,IDC_STATIC68_69,
//				IDC_STATIC70_71 ,IDC_STATIC72_73 ,IDC_STATIC74_75 ,IDC_STATIC76_77,IDC_STATIC78_79 };
//
//int idsEditUser[] = { IDC_EDIT_2to4_1_ContinueTime,IDC_Row,IDC_spare11,IDC_spare22,IDC_spare33,IDC_spare44,IDC_spare55,IDC_spare66 };
//
//int idsEdit[] = { IDC_EDIT_DishArrive_WaitTime,IDC_EDIT_Continue_Blow_time,IDC_EDIT_WaitTime_Inhale,IDC_EDIT_ContinueTime_Inhale,IDC_EDIT_Motor_Speed,IDC_EDIT_Num_SingleChannel,IDC_IEDIT_2to4_1_WaitTime,IDC_EDIT_OK1_Delay_time,
//				 IDC_EDIT16 ,IDC_EDIT_Block_Time,IDC_PackOK_DelayBlowTime, IDC_EDIT_PACKOK_blowTime ,IDC_OKPush_DelayTime,IDC_PackInhale_DelayTime, IDC_PackInhale_ContinueTime2 ,IDC_EDIT_1to2_ContinueTime,
//				IDC_PackPush_DelayTime,IDC_PackPush_CylinderSpreadTime,IDC_spare1,IDC_spare2,IDC_new_spare1,IDC_new_spare2,IDC_new_spare3,IDC_new_spare4,IDC_new_spare5,IDC_new_spare6 };
//
//void CCDialogIO_OnLine::UpdateUI(bool flag)
//{
//	int length;
//	int lengthUser;
//	int lenStaticUser, lenStatic, lenEditUser, lenEdit;
//	font.CreatePointFont(100, _T("微软雅黑"));
//	fontUser.CreatePointFont(250, _T("微软雅黑"));//250
//
//	length = sizeof(ids) / sizeof(ids[0]);
//	lengthUser = sizeof(idsUser) / sizeof(idsUser[0]);
//	lenStaticUser = sizeof(idsStaticUser) / sizeof(idsStaticUser[0]);
//	lenStatic = sizeof(idsStatic) / sizeof(idsStatic[0]);
//	lenEditUser = sizeof(idsEditUser) / sizeof(idsEditUser[0]);
//	lenEdit = sizeof(idsEdit) / sizeof(idsEdit[0]);
//
//	//郭烽注释
//	//if (flag)//用户模式
//	//{//隐藏
//	//	for (int i = 0; i < length; i++)
//	//	{
//	//		GetDlgItem(ids[i])->EnableWindow(FALSE);
//	//		GetDlgItem(ids[i])->ShowWindow(FALSE);
//	//	}
//	//	for (int i = 0; i < lenStatic; i++)
//	//	{
//	//		GetDlgItem(idsStatic[i])->EnableWindow(FALSE);
//	//		GetDlgItem(idsStatic[i])->ShowWindow(FALSE);
//	//	}
//	//	for (int i = 0; i < lenEdit; i++)
//	//	{
//	//		GetDlgItem(idsEdit[i])->EnableWindow(FALSE);
//	//		GetDlgItem(idsEdit[i])->ShowWindow(FALSE);
//	//	}
//	//	//放大
//	//	for (int i = 0; i < lengthUser; i++)
//	//	{//checkBox
//	//		CRect rect;
//	//		((CButton*)GetDlgItem(idsUser[i]))->GetWindowRect(rect);//对于窗口左上角为原点
//	//		ScreenToClient(rect);
//	//		m_rect[i] = rect;
//	//		rect.left = 0;
//	//		rect.top = 0 + 70 * i;
//	//		rect.bottom = 50 + 70 * i;//50:高度，90：中心间隔
//	//		rect.right = 450;
//	//		((CButton*)GetDlgItem(idsUser[i]))->MoveWindow(rect, 1);
//	//		((CButton*)GetDlgItem(idsUser[i]))->SetFont(&fontUser);
//	//	}
//	//	for (int i = 0; i < lenStaticUser; i++)
//	//	{
//	//		//Static控件
//	//		CRect rect;
//	//		((CButton*)GetDlgItem(idsStaticUser[i]))->GetWindowRect(rect);//对于窗口左上角为原点
//	//		ScreenToClient(rect);
//	//		m_rectStatic[i] = rect;
//	//		rect.left = 580;
//	//		rect.top = 0 + 60 * i;
//	//		rect.bottom = 50 + 60 * i;
//	//		rect.right = 900;
//	//		((CButton*)GetDlgItem(idsStaticUser[i]))->MoveWindow(rect, 1);
//	//		((CButton*)GetDlgItem(idsStaticUser[i]))->SetFont(&fontUser);
//	//		//Edit控件
//	//		((CButton*)GetDlgItem(idsEditUser[i]))->GetWindowRect(rect);//对于窗口左上角为原点
//	//		ScreenToClient(rect);
//	//		m_rectEdit[i] = rect;
//	//		rect.left = 950;
//	//		rect.top = 0 + 60 * i;
//	//		rect.bottom = 50 + 60 * i;
//	//		rect.right = 1100;
//	//		((CButton*)GetDlgItem(idsEditUser[i]))->MoveWindow(rect, 1);
//	//		((CButton*)GetDlgItem(idsEditUser[i]))->SetFont(&fontUser);
//	//	}
//	//}
//	//else
//	//{
//	//	for (int i = 0; i < lengthUser; i++)
//	//	{
//	//		((CButton*)GetDlgItem(idsUser[i]))->MoveWindow(m_rect[i], 1);
//	//		((CButton*)GetDlgItem(idsUser[i]))->SetFont(&font);
//	//	}
//	//	for (int i = 0; i < lenStaticUser; i++)
//	//	{
//	//		((CButton*)GetDlgItem(idsStaticUser[i]))->MoveWindow(m_rectStatic[i], 1);
//	//		((CButton*)GetDlgItem(idsStaticUser[i]))->SetFont(&font);
//	//		((CButton*)GetDlgItem(idsEditUser[i]))->MoveWindow(m_rectEdit[i], 1);
//	//		((CButton*)GetDlgItem(idsEditUser[i]))->SetFont(&font);
//	//	}
//
//	//	//回复显示
//	//	for (int i = 0; i < length; i++)
//	//	{
//	//		GetDlgItem(ids[i])->EnableWindow(TRUE);
//	//		GetDlgItem(ids[i])->ShowWindow(TRUE);
//	//	}
//	//	for (int i = 0; i < lenStatic; i++)
//	//	{
//	//		GetDlgItem(idsStatic[i])->EnableWindow(TRUE);
//	//		GetDlgItem(idsStatic[i])->ShowWindow(TRUE);
//	//	}
//	//	for (int i = 0; i < lenEdit; i++)
//	//	{
//	//		GetDlgItem(idsEdit[i])->EnableWindow(TRUE);
//	//		GetDlgItem(idsEdit[i])->ShowWindow(TRUE);
//	//	}
//
//
//
//	//}
//
//}

void CCDialogIO_OnLine::OnBnClickedCheck1()
{
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK1);
	if (p->GetCheck() == 1)//选中
		theApp.temp[3][4] = 1;
	else
		theApp.temp[3][4] = 0;
	Refresh();
}


void CCDialogIO_OnLine::OnBnClickedCheck2()
{
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK2);
	if (p->GetCheck() == 1)//选中
		theApp.temp[3][5] = 1;
	else
		theApp.temp[3][5] = 0;
	Refresh();
}




void CCDialogIO_OnLine::OnBnClickedCheck3()
{
	CButton* p = (CButton*)GetDlgItem(IDC_CHECK3);
	if (p->GetCheck() == 1)//选中
		theApp.temp[3][6] = 1;
	else
		theApp.temp[3][6] = 0;
	Refresh();
}


